/* 幼儿园外卖系统 - 公共样式 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

:root {
  /* 温暖餐厅风格配色 - 针对3-4岁小班优化 */
  --primary-color: #FF8C42;        /* 活力橙 - 主色 */
  --secondary-color: #7CB342;      /* 草绿色 - 辅色 */
  --accent-color: #FFD54F;         /* 阳光黄 - 强调色 */
  --bg-color: #FFF8E1;             /* 奶油白 - 背景 */
  
  /* 文字颜色系统 */
  --text-color: #3D3D3D;           /* 主要文字 - 深灰 */
  --text-secondary: #8B7355;       /* 次要文字 - 棕色 */
  
  /* 卡片和边框 */
  --card-bg: #FFFFFF;              /* 纯白卡片 */
  --border-color: #F0E6D2;         /* 浅米色边框 */
  
  /* 功能性颜色（保持不变） */
  --success-color: #52C41A;        /* 成功绿 */
  --warning-color: #FAAD14;        /* 警告橙 */
  --error-color: #FF4D4F;          /* 错误红 */
  --info-color: #1890FF;           /* 信息蓝 */
  
  /* 其他样式变量 */
  --border-radius: 16px;
  --shadow: 0 4px 12px rgba(255,140,66,0.15);  /* 橙色阴影 */
}

/* 平滑过渡动画 - 让颜色变化更友好 */
* {
  transition: background-color 0.3s ease, 
              color 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
}

/* 大按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  min-width: 100px;
  padding: 12px 24px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, #FF8C42, #FFA726);
  color: white;
  box-shadow: 0 4px 12px rgba(255,140,66,0.3);
}

.btn-primary:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(255,140,66,0.2);
}

.btn-secondary {
  background: linear-gradient(135deg, #7CB342, #8BC34A);
  color: white;
  box-shadow: 0 4px 12px rgba(124,179,66,0.3);
}

.btn-secondary:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(124,179,66,0.2);
}

.btn-accent {
  background: linear-gradient(135deg, #FFD54F, #FFE082);
  color: #3D3D3D;
  box-shadow: 0 4px 12px rgba(255,213,79,0.3);
}

.btn-accent:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(255,213,79,0.2);
}

.btn-large {
  min-height: 80px;
  min-width: 150px;
  font-size: 24px;
  padding: 16px 32px;
}

.btn-small {
  min-height: 48px;
  min-width: 80px;
  font-size: 16px;
  padding: 8px 16px;
}

/* 卡片样式 */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* 页面头部 */
.header {
  background: linear-gradient(135deg, var(--primary-color), #FFA726);
  color: white;
  padding: 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  max-width: 100%;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

/* 容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 网格布局 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

/* 弹性布局 */
.flex {
  display: flex;
  gap: 16px;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-center {
  justify-content: center;
  align-items: center;
}

/* 状态颜色 */
.status-pending { background: var(--warning-color); color: white; }
.status-prepared { background: var(--info-color); color: white; }
.status-delivering { background: #FFA07A; color: white; }
.status-completed { background: #90EE90; color: #333; }
.status-archived { background: #CCC; color: #666; }

/* 订单状态标签 */
.status-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: bold;
}

/* 数量选择器 */
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quantity-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--secondary-color);
  color: white;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-value {
  font-size: 24px;
  font-weight: bold;
  min-width: 40px;
  max-width: 60px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--border-radius);
  padding: 30px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-title {
  font-size: 24px;
  margin-bottom: 20px;
  text-align: center;
}

/* 选择列表 */
.select-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
}

.select-item {
  padding: 16px 20px;
  background: #f5f5f5;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  font-size: 20px;
  transition: all 0.2s;
}

.select-item:hover {
  background: var(--accent-color);
}

.select-item.selected {
  background: var(--secondary-color);
  color: white;
}

/* 自定义下拉选择器 */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 18px;
  border: 2px solid #ddd;
  border-radius: var(--border-radius);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 52px;
}

.custom-select-trigger:hover {
  border-color: var(--secondary-color);
}

.custom-select-trigger.active {
  border-color: var(--secondary-color);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.custom-select-trigger .selected-value {
  flex: 1;
  color: #333;
}

.custom-select-trigger .arrow {
  margin-left: 8px;
  font-size: 14px;
  color: #999;
  transition: transform 0.2s;
}

.custom-select-trigger.active .arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--secondary-color);
  border-top: none;
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.custom-select-option {
  padding: 12px 16px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover {
  background: #f5f5f5;
}

.custom-select-option.selected {
  background: var(--secondary-color);
  color: white;
}

.custom-select-option.selected:hover {
  background: var(--secondary-color);
}

/* 网络错误提示 */
.network-error {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--error-color);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 16px;
  z-index: 999;
  box-shadow: var(--shadow);
}

/* 最后更新时间 */
.last-update {
  position: fixed;
  bottom: 10px;
  right: 10px;
  font-size: 12px;
  color: #999;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  border-radius: 4px;
}

/* 成功提示 */
.success-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #90EE90;
  color: #333;
  padding: 16px 32px;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: bold;
  z-index: 1001;
  box-shadow: var(--shadow);
}

/* Toast 提示框 */
.toast-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.toast {
  padding: 16px 32px;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: bold;
  box-shadow: var(--shadow);
  text-align: center;
  min-width: 200px;
  max-width: 400px;
}

.toast-success {
  background: #90EE90;
  color: #333;
}

.toast-error {
  background: var(--error-color);
  color: white;
}

.toast-warning {
  background: #FFA500;
  color: white;
}

.toast-info {
  background: var(--info-color);
  color: white;
}

/* Confirm 确认对话框 */
.confirm-modal {
  max-width: 400px;
}

.confirm-message {
  font-size: 18px;
  margin-bottom: 24px;
  text-align: center;
  color: #333;
  line-height: 1.6;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-buttons .btn {
  flex: 1;
  min-width: 100px;
}

/* 图片占位 */
.img-placeholder {
  width: 100%;
  height: 150px;
  background: linear-gradient(135deg, #FFE4E1, #FFF0F5);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 12px 24px;
  background: #f5f5f5;
  border-radius: var(--border-radius);
  cursor: pointer;
  white-space: nowrap;
  font-size: 18px;
}

.tab.active {
  background: var(--primary-color);
  color: white;
}

/* 表单 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: bold;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 18px;
  border: 2px solid #ddd;
  border-radius: var(--border-radius);
}

.form-input:focus {
  outline: none;
  border-color: var(--secondary-color);
}

/* 大促横幅 */
.big-sale-banner {
  background: linear-gradient(135deg, #ff6b6b, #ff8787);
  color: white;
  padding: 15px 20px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  border-radius: 8px;
  margin-bottom: 20px;
  animation: pulse 2s infinite;
  max-width: 100%;
  box-sizing: border-box;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* 大促角标 */
.sale-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #ff6b6b, #ff8787);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  z-index: 1;
}

/* 原价划线 */
.original-price {
  text-decoration: line-through;
  color: #999;
  font-size: 14px;
  margin-right: 8px;
  white-space: nowrap;
}

/* 大促价高亮 */
.sale-price {
  color: #ff6b6b;
  font-size: 20px;
  font-weight: bold;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════ */
/* 统一响应式布局系统 */
/* ═══════════════════════════════════════════════════ */

/* 应用布局容器 */
.app-layout {
  display: flex;
  height: calc(100vh - 60px - 120px); /* 减去 header 高度和底部购物车栏高度，额外留10px间距 */
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

/* 侧边栏 */
.sidebar {
  width: 80px;
  flex-shrink: 0;
  background: #f5f5f5;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid #e0e0e0;
  max-width: 80px;
}

/* 侧边栏分类项 */
.sidebar-item {
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.sidebar-item:hover,
.sidebar-item.active {
  background: var(--primary-color);
  color: white;
}

/* 主内容区 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px 20px 20px; /* 上 右 下 左，底部增加20px间距 */
  background: #fafafa;
  max-width: calc(100% - 80px); /* 减去侧边栏宽度 */
}

/* 内容网格 - 统一单列布局，参考美团/饿了么 */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 100%;
}

/* 底部固定导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.bottom-nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  transition: all 0.2s;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--primary-color);
  background: #f0f0f0;
}

.bottom-nav-item .icon,
.bottom-nav-item svg {
  font-size: 20px;
  margin-bottom: 4px;
}

/* 带底部导航的内容区 */
.has-bottom-nav .app-layout {
  height: calc(100vh - 60px - 120px); /* header + bottom-nav + 额外间距 */
}

.has-bottom-nav .main-content {
  padding-bottom: 20px; /* 底部增加20px间距 */
}

/* ═══════════════════════════════════════════════════ */
/* 响应式断点 */
/* ═══════════════════════════════════════════════════ */

/* 手机端 (< 768px) */
@media (max-width: 767px) {
  .sidebar {
    width: 80px;
    max-width: 80px;
  }
  
  .sidebar-item {
    padding: 12px 4px;
    font-size: 12px;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
  }
  
  /* 手机端调整主内容区 padding，防止溢出 */
  .main-content {
    padding: 16px 16px 20px 16px; /* 上 右 下 左，底部增加20px间距 */
    max-width: calc(100% - 80px);
  }
}

/* 统一单列布局 - 所有设备 */
@media (min-width: 768px) {
  .sidebar {
    width: 100px;
    max-width: 100px;
  }
  
  .sidebar-item {
    padding: 20px 8px;
    font-size: 14px;
  }
  
  .main-content {
    max-width: calc(100% - 100px);
  }
}

/* 旧的响应式兼容 */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .btn {
    min-height: 56px;
    font-size: 18px;
  }
  
  .header h1 {
    font-size: 24px;
  }
}