/* 代理商后台 - 数据看板样式 */
/* 主色: #E8B4B8 柔粉 | 辅助: #9B8AA5 典雅紫 */

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f0ee;
  margin: 0;
  color: #333;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #E8B4B8 0%, #d4969c 100%);
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.sidebar .logo h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.sidebar .logo p {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

.sidebar nav {
  padding: 16px 0;
}

.sidebar nav a {
  display: block;
  padding: 12px 20px;
  color: white;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,0.2);
}

/* 主内容 */
.main-content {
  margin-left: 220px;
  flex: 1;
}

.top-bar {
  background: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.top-bar h1 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.user-info {
  font-size: 14px;
  color: #666;
}

.user-info span { margin-right: 12px; }
.user-info a { color: #E8B4B8; text-decoration: none; }

.content {
  padding: 24px 32px;
}

/* 指标卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card-label {
  font-size: 13px;
  color: #999;
  margin-bottom: 8px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.card-trend {
  font-size: 12px;
}

.card-trend.up { color: #52c41a; }
.card-trend.down { color: #f5222d; }

/* 图表区域 */
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-box {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chart-box h3 {
  margin: 0 0 16px;
  font-size: 15px;
  color: #333;
}

.chart-box canvas {
  width: 100% !important;
  height: 200px !important;
}

/* 近期订单表格 */
.recent-orders {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.recent-orders h3 {
  margin: 0 0 16px;
  font-size: 15px;
  color: #333;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

th {
  color: #999;
  font-weight: 500;
  background: #fafafa;
}

tr:last-child td { border-bottom: none; }

/* ==================== 移动端适配 ==================== */

/* 移动端菜单按钮 */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  background: #E8B4B8;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 1px;
  transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* 遮罩层 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

/* 平板适配 */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
}

/* 手机适配 */
@media (max-width: 768px) {
  /* 显示菜单按钮 */
  .menu-toggle { display: flex; }
  
  /* 侧边栏改为抽屉 */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }
  
  .sidebar.open { transform: translateX(0); }
  
  /* 主内容全宽 */
  .main-content { margin-left: 0; }
  
  /* 顶栏 */
  .top-bar {
    padding: 12px 16px;
    padding-left: 64px; /* 给菜单按钮留空间 */
  }
  
  .top-bar h1 { font-size: 16px; }
  
  .user-info { font-size: 12px; }
  .user-info span { margin-right: 8px; }
  
  /* 内容区 */
  .content { padding: 16px; }
  
  /* 统计卡片单列 */
  .stat-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .card { padding: 16px; }
  .card-value { font-size: 24px; }
  
  /* 图表 */
  .charts { grid-template-columns: 1fr; }
  
  .chart-box { padding: 16px; }
  .chart-box canvas { height: 180px !important; }
  
  /* 表格横向滚动 */
  .recent-orders {
    padding: 16px;
    overflow-x: auto;
  }
  
  table { min-width: 600px; }
  
  th, td { padding: 10px 8px; font-size: 12px; }
}

/* 小屏手机 */
@media (max-width: 375px) {
  .top-bar { padding-left: 56px; }
  .top-bar h1 { font-size: 14px; }
  .content { padding: 12px; }
  .card { padding: 12px; }
  .card-value { font-size: 20px; }
}