/* ============================================
   通信门店管理系统 2.0 — 公共样式 v2.1
   所有页面统一引用此文件
   更新: 2026-06-27 表格视觉升级
   ============================================ */

/* === 全局盒模型 === */
*, *::before, *::after { box-sizing: border-box; }

/* === body：无边距撑满视口，自身不滚动 === */
body {
  font-family: 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* === #app：占满 body === */
#app {
  width: 100%;
  height: 100%;
}

/* === 页面根容器：flex 列布局撑满视口，禁止自身滚动 === */
.page-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 8px;
}

/* === 数据区域：卡片化 === */
.data-section {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* 顶部区域（统计卡、工具栏等）不压缩 */
.page-root > [style*="display:flex"][style*="gap"],
.page-root > .stats-row,
.page-root > .tool-bar {
  flex-shrink: 0;
}

/* ============================================
   表格系统 — 统一风格
   ============================================ */

/* === 表格容器 === */
.table-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #ebeef5;
  border-radius: 6px;
}

/* 滚动条 */
.table-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.table-wrap::-webkit-scrollbar-track { background: #f5f7fa; border-radius: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c0c4cc; border-radius: 6px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #909399; }

/* === native-table 基础 === */
.native-table {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #303133;
}

/* 表格标题行 */
.table-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.table-title-row h3 {
  font-size: 16px;
  margin: 0;
  color: #303133;
  white-space: nowrap;
}

/* === thead === */
.native-table thead {
  background: #f0f2f5;
}
.native-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f0f2f5;
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: #606266;
  border: 1px solid #dcdfe6 !important;
  white-space: nowrap;
  user-select: none;
  vertical-align: middle;
}

/* === tbody === */
.native-table td {
  padding: 9px 12px;
  border: 1px solid #ebeef5 !important;
  transition: background 0.15s;
  vertical-align: middle;
}

/* 斑马纹 */
.native-table tbody tr:nth-child(even) { background: #fafbfc; }

/* 悬停 */
.native-table tbody tr:hover { background: #ecf5ff; }

/* 选中行 */
.native-table tbody tr.row-selected {
  background: #d9ecff !important;
}

/* === 固定列 === */
/* 左侧固定 */
.native-table td.sticky-left {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #fff;
  white-space: nowrap;
}
/* 左侧固定列表头 — 固定背景色，不透明 */
.native-table th.sticky-left {
  position: sticky;
  left: 0;
  z-index: 15;
  background: #f0f2f5;
}
/* 左侧固定列阴影 */
.native-table th.sticky-left::after,
.native-table td.sticky-left::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(0,0,0,0.06), transparent);
  pointer-events: none;
}
.native-table tbody tr:nth-child(even) td.sticky-left { background: #fafbfc; }
.native-table tbody tr:hover td.sticky-left { background: #ecf5ff; }
.native-table tbody tr.row-selected td.sticky-left { background: #d9ecff !important; }

/* 右侧固定 */
.native-table td.sticky-right {
  position: sticky;
  right: 0;
  z-index: 5;
  background: #fff;
  white-space: nowrap;
}
/* 右侧固定列表头 — 固定背景色 */
.native-table th.sticky-right {
  position: sticky;
  right: 0;
  z-index: 15;
  background: #f0f2f5;
}
/* 右侧固定列阴影 */
.native-table th.sticky-right::before,
.native-table td.sticky-right::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to left, rgba(0,0,0,0.06), transparent);
  pointer-events: none;
}
.native-table tbody tr:nth-child(even) td.sticky-right { background: #fafbfc; }
.native-table tbody tr:hover td.sticky-right { background: #ecf5ff; }
.native-table tbody tr.row-selected td.sticky-right { background: #d9ecff !important; }

/* 固定列斑马纹/悬停/选中 — 只对 tbody td 生效 */

/* === 换行列 === */
.native-table th.wrap-col,
.native-table td.wrap-col {
  white-space: nowrap !important;
  max-width: 220px;
  min-width: 120px;
}

/* === 数字列（右对齐）=== */
.native-table th.num-col,
.native-table td.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums; /* 等宽数字，对齐更整齐 */
  white-space: nowrap;
}

/* === 居中列 === */
.native-table th.center-col,
.native-table td.center-col {
  text-align: center;
  white-space: nowrap;
}

/* === 操作按钮组 === */
.nowrap-btns {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.nowrap-btns .el-button {
  padding: 2px 8px;
  font-size: 12px;
}
.nowrap-btns .el-button + .el-button { margin-left: 0; }

/* === 空状态 === */
.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  color: #c0c4cc;
  font-size: 14px;
}
.table-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.table-empty .empty-text {
  color: #909399;
}
.table-empty .empty-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #c0c4cc;
}

/* === 表格密度控制 === */
/* 紧凑 */
.native-table.table-dense th { padding: 6px 10px; }
.native-table.table-dense td { padding: 5px 10px; font-size: 12px; }

/* 宽松 */
.native-table.table-loose th { padding: 14px 14px; }
.native-table.table-loose td { padding: 13px 14px; }

/* ============================================
   Element Plus el-table 全局覆盖 — 与 native-table 统一
   ============================================ */
.el-table {
  font-size: 13px;
  color: #303133;
}
.el-table thead th.el-table__cell {
  background: #f0f2f5;
  color: #606266;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 12px;
  user-select: none;
  vertical-align: middle;
}
.el-table tbody td.el-table__cell {
  padding: 9px 12px;
  color: #303133;
  vertical-align: middle;
}
/* el-table 数字列 */
.el-table .el-table__cell.is-right,
.el-table th.is-right {
  text-align: right;
}
.el-table .el-table__cell.is-center,
.el-table th.is-center {
  text-align: center;
}
.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
  background: #fafbfc;
}
.el-table tbody tr:hover > td.el-table__cell {
  background: #ecf5ff !important;
}
.el-table .el-table__inner-wrapper::before,
.el-table .el-table__inner-wrapper::after {
  display: none;
}
/* 固定列阴影 */
.el-table .el-table__fixed-right-patch {
  background: inherit;
}
/* 分页在表格内时 */
.el-table .el-table__body-wrapper + .el-pagination {
  margin-top: 12px;
}

/* === 统计卡片行（白底+左侧彩条方案） === */
.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}
/* 紧凑型 — 更小的间距和卡片 */
.stats-row--compact {
  gap: 8px;
}
.stats-row--compact .stat-card {
  min-width: 100px !important;
  max-width: 220px !important;
  padding: 10px 14px !important;
}
/* 卡片基础：白色底 + 左侧彩条 */
.stats-row .stat-card {
  flex: 1 1 0;
  min-width: 120px;
  max-width: 260px;
  border-radius: 8px;
  padding: 11px 15px;
  color: var(--theme-text-primary, #303133);
  background: var(--theme-card-bg, #fff) !important;
  border: 0.5px solid var(--theme-border-color, #e4e7ed);
  box-shadow: none;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* 卡片内文字工具类 */
.stat-label {
  font-size: 12px;
  color: #606266;
  margin-bottom: 1px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a !important;
  line-height: 1.2;
}
.stat-value--small {
  font-size: 14px;
}
/* 左侧彩条通过 ::before 实现 */
.stats-row .stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--card-accent, #409eff);
  border-radius: 4px 0 0 4px;
}
/* 彩条色板 — 每张卡片用不同颜色区分 */
.stat-bar-blue   { --card-accent: #3b82f6; }
.stat-bar-purple { --card-accent: #667eea; }
.stat-bar-red    { --card-accent: #ef4444; }
.stat-bar-green  { --card-accent: #22c55e; }
.stat-bar-orange { --card-accent: #f97316; }
.stat-bar-cyan   { --card-accent: #06b6d4; }
.stat-bar-pink   { --card-accent: #ec4899; }
.stat-bar-amber  { --card-accent: #f59e0b; }
.stats-row .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* === 工具栏行 === */
.tool-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #fafbfc;
  border-radius: 6px;
  border: 1px solid #ebeef5;
}
/* ★ v=b199: 工具栏内所有子元素固定宽度，不被flex拉伸 */
.tool-bar > .el-input,
.tool-bar > .el-select,
.tool-bar > .el-date-editor {
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}
.tool-bar > h3 {
  flex-shrink: 0;
}
.tool-bar h3 {
  font-size: 16px;
  margin: 0;
  white-space: nowrap;
}

/* === 分页器：在表格下方，右对齐 === */
.pagination-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  flex-shrink: 0;
  padding: 8px 0;
}

/* === 隐藏数字输入框上下箭头（全局）=== */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
}

/* === 门店员工列表列 === */
.emp-list-col {
  max-width: 240px;
}
.emp-item {
  display: inline-block;
  background: #ecf5ff;
  color: #409eff;
  border: 1px solid #d9ecff;
  border-radius: 4px;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  line-height: 1.6;
}

/* ============================================
   index.html 主框架样式（从内联样式迁移）
   ============================================ */
/* === 主布局：sidebar + main === */
body.index-page {
  display: flex;
  font-family: 'Microsoft YaHei', sans-serif;
  overflow: hidden;
}
body.index-page #app {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* === 侧边栏 === */
.sidebar {
  width: 200px;
  min-width: 200px;
  background: #2c3e50;
  color: #ecf0f1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
}
.sidebar .logo {
  padding: 18px 15px;
  font-size: 17px;
  font-weight: bold;
  border-bottom: 1px solid #34495e;
  text-align: center;
}
.sidebar .menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.menu-item {
  padding: 11px 18px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
  white-space: nowrap;
}
.menu-item:hover {
  background: #34495e;
}
.menu-item.active {
  background: #409eff;
}

/* === 主内容区 === */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* === 顶部标签栏 === */
.topbar {
  height: 40px;
  min-height: 40px;
  background: #fff;
  border-bottom: 1px solid #ebeef5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 13px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  gap: 12px;
}
.topbar-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.topbar-left::-webkit-scrollbar {
  height: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* === 标签页 === */
.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 13px;
  color: #606266;
  background: #f5f7fa;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}
.tab-item.active {
  background: #409eff;
  color: #fff;
  border-color: #409eff;
}
.tab-item:hover:not(.active) {
  background: #ebeef5;
}
.tab-close {
  font-size: 12px;
  margin-left: 2px;
  opacity: 0.6;
  cursor: pointer;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-close:hover {
  opacity: 1;
  background: rgba(0,0,0,0.15);
}
.topbar .user-name {
  color: #303133;
  font-weight: 600;
  cursor: pointer;
}

/* === 内容区 SPA 容器（router-view 渲染区） === */
.content {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.content > * {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
  overflow: auto;
}

/* ============================================
   订单页面兼容：main-wrapper / content 内嵌层
   订单页有多层嵌套，需要透传高度到 .page-root
   ============================================ */
.main-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.main-wrapper > .content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ============================================
   全局悬浮按钮（FAB）— 左侧导航底部居中
   ============================================ */
.global-fab {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}
.global-fab .el-button {
  border-radius: 8px;
  font-size: 14px;
  padding: 10px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.global-fab .el-button:hover {
  box-shadow: 0 4px 12px rgba(103,194,58,0.4);
}

/* ============================================
   子页面通用布局：左侧导航 + 右侧内容
   所有子页面（非 index.html）统一使用此布局
   ============================================ */

/* 子页面 body 改为 flex 横向布局 */
body.has-sidebar {
  display: flex;
  overflow: hidden;
}

body.has-sidebar #app {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* 布局容器：sidebar + main */
.app-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

/* === 左侧导航栏 === */
.app-sidebar {
  width: 180px;
  min-width: 180px;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #ecf0f1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  z-index: 100;
}
.app-sidebar .sidebar-logo {
  padding: 18px 12px;
  font-size: 15px;
  font-weight: bold;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  background: rgba(0,0,0,0.15);
  letter-spacing: 2px;
}
.app-sidebar .sidebar-logo .logo-icon {
  font-size: 22px;
  margin-right: 6px;
}
.app-sidebar .sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.app-sidebar .sidebar-nav::-webkit-scrollbar { width: 4px; }
.app-sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* 导航项 */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  white-space: nowrap;
  position: relative;
  color: #b8c5d6;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(64,158,255,0.25) 0%, transparent 100%);
  color: #fff;
  border-left-color: #409eff;
  font-weight: 600;
}
.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* 导航底部区域 */
.app-sidebar .sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.app-sidebar .sidebar-footer .quick-entry-btn {
  width: 100%;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.app-sidebar .sidebar-footer .quick-entry-btn:hover {
  box-shadow: 0 4px 12px rgba(103,194,58,0.4);
}

/* 用户信息区 */
.app-sidebar .sidebar-user {
  padding: 10px 14px;
  font-size: 12px;
  color: #8896a7;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.app-sidebar .sidebar-user:hover {
  color: #fff;
  background: rgba(255,255,255,0.04);
}

/* === 主内容区 === */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f5f7fa;
}

/* 主内容区内 .page-root 去掉自身 padding（由 app-main 控制） */
.app-main > .page-root {
  padding: 12px;
  height: 100%;
}

/* ============================================
   通用弹窗滚动条 — 所有 el-dialog 统一
   ============================================ */
/* align-center 已在 el-dialog 标签上声明，无需额外 CSS 控制 overlay */
.el-overlay .el-dialog {
  display: flex !important;
  flex-direction: column !important;
  max-height: 90vh !important;
  margin: auto !important;
}
.el-overlay .el-dialog__header {
  flex-shrink: 0 !important;
}
.el-overlay .el-dialog__body {
  overflow-y: auto !important;
  flex: 1 !important;
  min-height: 0 !important;
}
.el-overlay .el-dialog__footer {
  flex-shrink: 0 !important;
}

/* === 隐藏数字输入框的上下箭头（用于支付金额输入）=== */
.no-spin-input input[type=number]::-webkit-outer-spin-button,
.no-spin-input input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.no-spin-input input[type=number] {
  -moz-appearance: textfield;
}
