/* 全局样式 - 家庭点菜系统 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f6fa;
  color: #2d3436;
  min-height: 100vh;
}

/* ===== 登录页 ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
  text-align: center;
  font-size: 26px;
  color: #2d3436;
  margin-bottom: 8px;
}

.login-card .subtitle {
  text-align: center;
  color: #95a5a6;
  font-size: 14px;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #636e72;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #dfe6e9;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.btn-secondary {
  background: #dfe6e9;
  color: #2d3436;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-success {
  background: #27ae60;
  color: #fff;
}

.btn-warning {
  background: #f39c12;
  color: #fff;
}

.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.error-msg {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  min-height: 20px;
}

/* ===== 主界面布局 ===== */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #2d3436;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 24px 20px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar .brand .brand-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #b2bec3;
  margin-top: 4px;
}

.sidebar nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar nav a {
  display: block;
  padding: 14px 24px;
  color: #b2bec3;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }

.sidebar nav a.active {
  color: #fff;
  background: rgba(102,126,234,0.2);
  border-left-color: #667eea;
}

.sidebar .user-info {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px;
}

.sidebar .user-info .name { color: #fff; font-weight: 600; }

.sidebar .user-info .logout-btn {
  margin-top: 8px;
  width: 100%;
  padding: 6px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.sidebar .user-info .logout-btn:hover { background: rgba(255,255,255,0.2); }

.main-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
}

.page { display: none; }
.page.active { display: block; }

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

.page-header h2 { font-size: 22px; }

.page-header .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== 卡片网格 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.card .card-img {
  height: 150px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card .card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .card-img .no-img {
  color: #b2bec3;
  font-size: 40px;
}

.card .card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card .card-title {
  font-size: 16px;
  font-weight: 600;
}

.card .card-category {
  font-size: 12px;
  color: #667eea;
  background: rgba(102,126,234,0.1);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  align-self: flex-start;
}

.card .card-info {
  font-size: 13px;
  color: #636e72;
}

.card .card-footer {
  padding: 10px 14px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card .card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.price {
  color: #e74c3c;
  font-weight: 700;
}

.calories {
  color: #f39c12;
  font-size: 12px;
}

.rating {
  color: #f39c12;
  font-size: 13px;
}

.status-tag {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.status-on { background: #d5f5e3; color: #27ae60; }
.status-off { background: #fadbd8; color: #e74c3c; }
.status-pending { background: #fdebd0; color: #e67e22; }
.status-done { background: #d5f5e3; color: #27ae60; }

/* ===== 表格 ===== */
.table-wrapper {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

th {
  background: #fafbfc;
  font-weight: 600;
  color: #636e72;
}

tr:hover { background: #fafbfc; }

/* ===== 表单弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal h3 { margin-bottom: 20px; font-size: 18px; }

.modal .modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ===== 点菜 ===== */
.order-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

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

.quantity-control button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #dfe6e9;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-control button:hover { background: #f0f0f0; }

.cart-badge {
  background: #e74c3c;
  color: #fff;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
}

/* ===== 汇总卡片 ===== */
.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f5f6fa;
  align-items: center;
}

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

.summary-item .qty {
  background: #667eea;
  color: #fff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
}

/* ===== 过滤栏 ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.filter-bar select,
.filter-bar input {
  padding: 8px 12px;
  border: 1px solid #dfe6e9;
  border-radius: 8px;
  font-size: 13px;
}

/* ===== 评价 ===== */
.star-display { color: #f39c12; }

.recipe-box {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .sidebar .brand {
    border-bottom: none;
    padding: 12px 16px;
    font-size: 16px;
  }
  .sidebar nav {
    display: flex;
    padding: 0;
    overflow-x: auto;
    flex: 1;
  }
  .sidebar nav a {
    padding: 12px 14px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: 13px;
  }
  .sidebar nav a.active {
    border-left: none;
    border-bottom-color: #667eea;
  }
  .sidebar .user-info {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .sidebar .user-info .logout-btn { margin-top: 0; width: auto; }
  .main-content { padding: 16px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}