
/* 秘恋授权书管理系统 V1.3.3 手机端显示修复
   基于 V1.3.2 完整恢复包。
   只做响应式显示，不改 LOGO 文件、不改业务逻辑。 */

/* 防止手机端整体横向溢出 */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* 登录页手机适配 */
@media (max-width: 768px) {
  #loginLayer {
    position: fixed;
    inset: 0;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 22px 14px;
    box-sizing: border-box;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
  }

  #loginLayer .login-box {
    width: 100%;
    max-width: 390px;
    min-width: 0;
    margin: 26px auto 0;
    padding: 24px 18px 22px;
    border-radius: 16px;
    box-sizing: border-box;
  }

  #loginLayer .login-logo {
    width: 180px;
    max-width: 82%;
    height: auto;
    object-fit: contain;
  }

  #loginLayer .login-box h2 {
    font-size: 21px;
    line-height: 1.25;
    white-space: normal;
  }

  #loginLayer .login-box p {
    font-size: 14px;
  }

  #loginLayer .login-box input,
  #loginLayer .login-box button {
    width: 100%;
    height: 48px;
    font-size: 16px;
    box-sizing: border-box;
  }
}

/* 后台主界面手机适配 */
@media (max-width: 768px) {
  .layout,
  .app,
  .main,
  .content,
  main {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* 侧边栏改成顶部横向滚动，避免挤压内容 */
  .sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    height: auto;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .sidebar .nav,
  .nav-menu,
  .menu {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .sidebar a,
  .sidebar button,
  .nav-item {
    flex: 0 0 auto;
  }

  /* 内容区域全宽 */
  .main,
  .page,
  .content {
    margin-left: 0;
    padding: 14px;
  }

  /* 表单在手机端单列 */
  .form-grid,
  .grid,
  .settings-grid,
  .user-create {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  input,
  select,
  textarea,
  button {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* 表格横向滚动，不撑破手机屏 */
  table {
    min-width: 760px;
  }

  .table-wrap,
  .card,
  .panel,
  .empty {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
  }

  /* 卡片栅格改成单列 */
  .cards,
  .dashboard-grid,
  .template-grid,
  .quick-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }
}

@media (max-width: 390px) {
  #loginLayer .login-logo {
    width: 160px;
  }

  #loginLayer .login-box h2 {
    font-size: 19px;
  }

  .main,
  .page,
  .content {
    padding: 12px;
  }
}


/* V1.3.4 手机端菜单优化：不再依赖右滑，自动换行显示全部菜单 */
@media (max-width: 768px) {
  .sidebar {
    overflow-x: visible;
    white-space: normal;
  }

  .sidebar .nav,
  .nav-menu,
  .menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    overflow-x: visible;
    white-space: normal;
    padding: 0 0 10px;
  }

  .sidebar a,
  .sidebar button,
  .nav-item {
    width: 100%;
    min-width: 0;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 14px;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .sidebar .nav,
  .nav-menu,
  .menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .sidebar a,
  .sidebar button,
  .nav-item {
    height: 44px;
    font-size: 13px;
    padding: 0 6px;
  }
}

@media (max-width: 340px) {
  .sidebar .nav,
  .nav-menu,
  .menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* V1.3.5 新增授权操作按钮优化 */
@media (max-width: 768px) {
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-actions button {
    width: 100%;
  }
}


/* V1.3.6 保存并下载生成中提示 */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  box-sizing: border-box;
}

.loading-box {
  width: min(320px, 92vw);
  background: #ffffff;
  border-radius: 18px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #dbeafe;
  border-top-color: #1677ff;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: meleon-spin 0.8s linear infinite;
}

.loading-title {
  font-size: 20px;
  font-weight: 800;
  color: #101828;
  margin-bottom: 8px;
}

.loading-desc {
  font-size: 14px;
  color: #667085;
  line-height: 1.5;
}

@keyframes meleon-spin {
  to { transform: rotate(360deg); }
}
