/* ==========================================================================
 * peiste-cabinets.cn 移动端响应式 + 主页增强
 * 追加于 theme-cream.css 之后加载
 * 创建: 2026-06-06
 * ========================================================================== */

/* ==========================================================================
 * L2: 主页"工作台"卡片化增强
 * ========================================================================== */

/* 欢迎横幅 (Hero) */
.dashboard > h2.page-title,
h2.page-title {
  position: relative;
  padding-left: 16px;
  border-left: 4px solid var(--primary);
  line-height: 1.4;
}

/* 数字卡加大 + 悬停动效 */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  opacity: 0.5;
  transition: all 0.4s ease;
  pointer-events: none;
}

.stat-card:hover::before {
  top: -40%;
  right: -20%;
  opacity: 0.8;
}

/* 让 dashboard 上下结构更紧实 */
.dashboard .el-row + .el-row {
  margin-top: 20px;
}

/* 财务概览面板精致化 */
.panel,
.section {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 12px !important;
  padding: 24px !important;
  box-shadow: var(--shadow) !important;
  transition: all 0.3s ease;
}

.panel h3,
.section h3 {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.commission-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-light);
}

.commission-item:last-child {
  border-bottom: none;
}

.commission-item span:first-child {
  color: var(--text-sub);
  font-size: 14px;
}

.amount {
  font-size: 15px;
  font-weight: 700;
}

.amount.success { color: var(--success) !important; }
.amount.warning { color: var(--warning) !important; }

/* ==========================================================================
 * L3: 全局响应式 (@media)
 * ========================================================================== */

/* ----- 平板 (≤ 1024px) ----- */
@media (max-width: 1024px) {
  .stat-card {
    padding: 18px !important;
  }
  .stat-value {
    font-size: 24px !important;
  }
  .stat-icon {
    width: 48px !important;
    height: 48px !important;
    font-size: 24px !important;
  }
}

/* ----- 移动端 (≤ 768px) ----- */
@media (max-width: 768px) {

  /* 根字号缩放 */
  html { font-size: 14px; }

  /* 主内容区 padding 缩 */
  .el-main,
  .layout-main,
  .app-main,
  [class*="main-content"] {
    padding: 12px !important;
  }

  /* ----- 侧栏变顶部抽屉 ----- */
  .el-aside,
  .desktop-sidebar,
  .sidebar,
  [class*="el-aside"] {
    position: fixed !important;
    top: 0;
    left: -280px;
    width: 260px !important;
    height: 100vh !important;
    z-index: 2000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }

  .el-aside.mobile-open,
  .desktop-sidebar.mobile-open,
  .sidebar.mobile-open {
    left: 0 !important;
  }

  /* ----- 顶栏加汉堡按钮 ----- */
  .el-header,
  .layout-header,
  .app-header,
  [class*="header"] {
    height: 56px !important;
    padding: 0 12px !important;
    position: sticky;
    top: 0;
    z-index: 1500;
  }

  /* 汉堡按钮 (通过 JS 触发) */
  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-soft);
    border: none;
    border-radius: 8px;
    color: var(--primary-dark);
    font-size: 20px;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.2s;
  }
  .mobile-menu-toggle:hover {
    background: var(--primary);
    color: white;
  }
  .mobile-menu-toggle:active {
    transform: scale(0.95);
  }

  /* 蒙层 */
  .mobile-menu-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1999;
    animation: fadeIn 0.2s;
  }
  .mobile-menu-mask.show {
    display: block;
  }
  @keyframes fadeIn { from {opacity:0;} to {opacity:1;} }

  /* ----- 顶栏元素简化 ----- */
  .layout-header-right .el-dropdown,
  .header-right .el-dropdown,
  .app-header-right .el-dropdown {
    margin-left: auto;
  }
  .layout-header-right > *:not(:last-child),
  .header-right > *:not(:last-child),
  .app-header-right > *:not(:last-child) {
    display: none !important;
  }

  /* ----- 4 列统计卡 → 2 列 ----- */
  .el-row.is-justify-space-around .el-col,
  .stat-cards .el-col,
  .dashboard .el-row:first-of-type .el-col {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding: 6px !important;
  }

  /* 数字卡更紧凑 */
  .stat-card {
    padding: 14px !important;
    gap: 10px !important;
  }
  .stat-value {
    font-size: 20px !important;
  }
  .stat-label {
    font-size: 12px !important;
  }
  .stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
  }

  /* ----- 工作台表格 → 卡片化 ----- */
  .el-table {
    font-size: 13px;
  }
  .el-table .el-table__cell {
    padding: 6px 0 !important;
  }

  /* ----- 页面标题缩小 ----- */
  .page-title,
  h2.page-title {
    font-size: 18px !important;
    margin-bottom: 12px;
  }

  /* ----- Card 紧凑化 ----- */
  .el-card {
    border-radius: 10px !important;
  }
  .el-card__header {
    padding: 12px 14px !important;
    font-size: 14px;
  }
  .el-card__body {
    padding: 14px !important;
  }

  /* ----- Panel 紧凑化 ----- */
  .panel,
  .section {
    padding: 16px !important;
  }

  /* ----- Dashboard 内部 row 垂直堆叠 ----- */
  .dashboard .finance-row .el-col,
  .dashboard > .el-row:nth-child(n+2) .el-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 12px;
  }

  /* ----- 通用表单元素触摸友好 ----- */
  .el-button {
    min-height: 36px;
  }
  .el-input__inner,
  .el-textarea__inner {
    font-size: 16px !important;  /* 防止 iOS 自动放大 */
  }

  /* ----- Dialog/Drawer 全屏化 ----- */
  .el-dialog {
    width: 92% !important;
    margin: 6vh auto !important;
    border-radius: 12px !important;
  }
  .el-drawer {
    width: 85% !important;
  }

  /* ----- Tabs 横向滚动 ----- */
  .el-tabs__nav-wrap--scrollable .el-tabs__nav {
    overflow-x: auto;
    white-space: nowrap;
  }

  /* ----- 分页紧凑 ----- */
  .el-pagination {
    flex-wrap: wrap;
    justify-content: center;
  }
  .el-pagination .el-pagination__sizes,
  .el-pagination .el-pagination__jump {
    display: none !important;
  }
}

/* ----- 极窄屏 (≤ 480px) ----- */
@media (max-width: 480px) {
  html { font-size: 13px; }
  .stat-cards .el-col,
  .dashboard .el-row:first-of-type .el-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .stat-card {
    padding: 12px !important;
  }
}

/* ----- PC 端默认隐藏汉堡按钮 ----- */
.mobile-menu-toggle {
  display: none;
}

@media (min-width: 769px) {
  .mobile-menu-toggle {
    display: none !important;
  }
  .mobile-menu-mask {
    display: none !important;
  }
}
