/* 简易收银系统 - 样式表 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --accent-dark: #ea580c;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* 顶部导航 */
.header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header h1 {
  font-size: 1.125rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 底部导航 */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  color: var(--gray-500);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

/* 主内容区 */
.main-content {
  padding: 16px;
  padding-bottom: 80px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 卡片 */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--gray-800);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: var(--accent-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
}

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gray-700);
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

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

/* 菜品网格 */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.menu-item {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.menu-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.menu-item.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.menu-item-name {
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 0.875rem;
}

.menu-item-price {
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}

/* 订单列表 */
.order-list {
  space-y: 12px;
}

.order-item {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.order-item-info {
  flex: 1;
}

.order-item-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.order-item-price {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.order-item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gray-300);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.quantity-btn:hover {
  background: var(--gray-100);
}

.quantity-value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

/* 订单卡片 */
.order-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.order-card.pending {
  border-left-color: var(--warning);
}

.order-card.completed {
  border-left-color: var(--success);
}

.order-card.cancelled {
  border-left-color: var(--danger);
  opacity: 0.7;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.order-number {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
}

.order-time {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.order-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.order-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.order-status.completed {
  background: #dcfce7;
  color: #166534;
}

.order-status.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.order-items {
  margin-bottom: 12px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--gray-200);
  font-size: 0.875rem;
}

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

.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 2px solid var(--gray-100);
}

.order-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

/* 分类标签 */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.category-tab {
  padding: 8px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  background: white;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

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

/* 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--gray-500);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-500);
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 12px;
}

/* 列表项 */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: white;
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.list-item-info h4 {
  font-weight: 500;
  margin-bottom: 2px;
}

.list-item-info p {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.list-item-actions {
  display: flex;
  gap: 8px;
}

/* 汇总栏 */
.summary-bar {
  position: fixed;
  bottom: 70px;
  left: 0;
  right: 0;
  background: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 90;
}

.summary-info {
  display: flex;
  flex-direction: column;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

/* 反馈按钮 */
.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.feedback-btn:hover {
  background: rgba(255,255,255,0.25);
}

.feedback-btn svg {
  width: 14px;
  height: 14px;
}

/* 响应式 */
@media (min-width: 768px) {
  .menu-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .main-content {
    padding: 24px;
    padding-bottom: 100px;
  }
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* 图表 */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  width: 100% !important;
  display: block;
}

.chart-pie-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.chart-pie-wrap canvas {
  width: 200px !important;
  height: 200px !important;
  flex-shrink: 0;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--gray-700);
}

.chart-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.chart-legend-value {
  margin-left: auto;
  font-weight: 600;
  color: var(--gray-800);
  padding-left: 12px;
}

.chart-empty {
  display: none;
  text-align: center;
  padding: 32px 16px;
  color: var(--gray-400);
  font-size: 0.875rem;
}

/* 打印样式 */
@media print {
  .header,
  .nav-bar,
  .summary-bar,
  .btn {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
