/* ============================================================
   Love Recipe - 后台管理样式
   ============================================================ */

:root {
  --a-color-bg: #1A1F2E;
  --a-color-sidebar: #131720;
  --a-color-sidebar-hover: #1E2435;
  --a-color-sidebar-active: #252D40;
  --a-color-card: #FFFFFF;
  --a-color-page-bg: #F4F6FA;
  --a-color-primary: #E8603C;
  --a-color-primary-light: #F4A261;
  --a-color-primary-ultra-light: #FDE8D8;
  --a-color-text: #1E2333;
  --a-color-text-muted: #6B7280;
  --a-color-border: #E5E7EB;
  --a-color-success: #10B981;
  --a-color-danger: #EF4444;
  --a-color-warning: #F59E0B;
  --a-color-info: #3B82F6;
  --a-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --a-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.05);
  --a-shadow-card: 0 2px 15px rgba(0,0,0,0.06);
  --a-radius-sm: 6px;
  --a-radius-md: 10px;
  --a-radius-lg: 14px;
  --a-font: 'Noto Serif SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --a-transition: all 0.2s ease;
  --sidebar-width: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--a-font);
  background: var(--a-color-page-bg);
  color: var(--a-color-text);
  line-height: 1.5;
  min-height: 100vh;
}
a { text-decoration: none; color: var(--a-color-primary); transition: var(--a-transition); }
button { cursor: pointer; border: none; font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  background: linear-gradient(135deg, #FFF3E8, #FDE8D8 40%, #FFF8F0);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-container { width: 100%; max-width: 420px; position: relative; z-index: 2; }
.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
  font-size: 48px;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--a-color-primary), var(--a-color-primary-light));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(232,96,60,0.3);
}
.login-logo-title {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 28px;
  color: #6B4226;
  margin-bottom: 4px;
}
.login-logo-sub { font-size: 14px; color: var(--a-color-text-muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-footer { text-align: center; margin-top: 20px; }
.login-bg-deco {
  position: absolute;
  bottom: 40px;
  right: -20px;
  display: flex;
  gap: 12px;
  font-size: 40px;
  opacity: 0.1;
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   Admin Layout
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--a-color-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-icon {
  font-size: 24px;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--a-color-primary), var(--a-color-primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(232,96,60,0.3);
}
.sidebar-logo-name {
  font-size: 16px;
  font-weight: 700;
  color: white;
  line-height: 1.3;
}
.sidebar-logo-sub { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--a-radius-md);
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  margin-bottom: 4px;
  transition: var(--a-transition);
}
.sidebar-link:hover { color: white; background: var(--a-color-sidebar-hover); }
.sidebar-link.active { color: white; background: var(--a-color-sidebar-active); border-left: 3px solid var(--a-color-primary); }
.sidebar-link--danger:hover { color: #FCA5A5; background: rgba(239,68,68,0.1); }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 12px 0; }

/* Main Area */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.admin-topbar {
  height: 60px;
  background: white;
  border-bottom: 1px solid var(--a-color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--a-shadow-sm);
}
.sidebar-toggle {
  display: none;
  font-size: 20px;
  color: var(--a-color-text-muted);
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
}
.admin-page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--a-color-text);
  flex: 1;
}
.topbar-right { margin-left: auto; }
.topbar-admin-badge {
  font-size: 13px;
  color: var(--a-color-text-muted);
  background: var(--a-color-page-bg);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--a-color-border);
}
.admin-content { padding: 24px; flex: 1; }

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--a-color-card);
  border-radius: var(--a-radius-lg);
  box-shadow: var(--a-shadow-card);
  border: 1px solid var(--a-color-border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--a-color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FAFBFC;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--a-color-text); }
.card-body { padding: 20px; }

/* ============================================================
   Stats Dashboard
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--a-radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--a-shadow-card);
  border: 1px solid var(--a-color-border);
  transition: var(--a-transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--a-shadow-md); }
.stat-card--highlight { border-left: 4px solid var(--a-color-primary); }
.stat-icon { font-size: 36px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--a-color-primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--a-color-text-muted); margin-top: 4px; }

.section-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--a-color-text); }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.action-card {
  background: white;
  border: 1px solid var(--a-color-border);
  border-radius: var(--a-radius-md);
  padding: 20px 16px;
  text-align: center;
  transition: var(--a-transition);
  color: var(--a-color-text);
}
.action-card:hover { border-color: var(--a-color-primary); color: var(--a-color-primary); transform: translateY(-2px); box-shadow: var(--a-shadow-md); }
.action-icon { font-size: 32px; margin-bottom: 8px; }
.action-label { font-size: 14px; font-weight: 600; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--a-color-text-muted);
  background: #F9FAFB;
  border-bottom: 1px solid var(--a-color-border);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
  color: var(--a-color-text);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #FAFBFF; }
.action-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: #F3F4F6;
  color: var(--a-color-text-muted);
  white-space: nowrap;
}
.badge-cold { background: #EBF5FB; color: #5BA4E0; }
.badge-hot { background: #FEF3EE; color: #FF7043; }
.badge-category { background: var(--a-color-primary-ultra-light); color: var(--a-color-primary); }

/* ============================================================
   Buttons
   ============================================================ */
.btn-admin-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--a-color-primary), var(--a-color-primary-light));
  color: white;
  border: none;
  border-radius: var(--a-radius-md);
  padding: 10px 20px;
  font-size: 14px;
  font-family: var(--a-font);
  font-weight: 600;
  cursor: pointer;
  transition: var(--a-transition);
  box-shadow: 0 2px 8px rgba(232,96,60,0.25);
  white-space: nowrap;
}
.btn-admin-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,96,60,0.35); }
.btn-sm-action {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--a-radius-sm);
}
.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--a-radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--a-font);
  cursor: pointer;
  transition: var(--a-transition);
  border: none;
  white-space: nowrap;
}
.btn-secondary {
  background: #F3F4F6;
  color: var(--a-color-text);
  border: 1px solid var(--a-color-border);
}
.btn-secondary:hover { background: #E5E7EB; color: var(--a-color-primary); }
.btn-danger { background: #FEF2F2; color: var(--a-color-danger); border: 1px solid #FECACA; }
.btn-danger:hover { background: var(--a-color-danger); color: white; }
.btn-secondary-outline {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--a-radius-sm);
  font-size: 14px;
  font-family: var(--a-font);
  color: var(--a-color-text-muted);
  border: 1px solid var(--a-color-border);
  background: white;
  cursor: pointer;
  transition: var(--a-transition);
}
.btn-secondary-outline:hover { border-color: var(--a-color-primary); color: var(--a-color-primary); }

/* Status Toggle */
.status-toggle {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--a-font);
  cursor: pointer;
  transition: var(--a-transition);
  border: none;
}
.status-on { background: #D1FAE5; color: #059669; }
.status-on:hover { background: #059669; color: white; }
.status-off { background: #F3F4F6; color: #9CA3AF; }
.status-off:hover { background: #374151; color: white; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--a-color-text); }
.required { color: var(--a-color-danger); }
.form-input, .form-textarea, .form-select {
  background: #F9FAFB;
  border: 1.5px solid var(--a-color-border);
  border-radius: var(--a-radius-sm);
  padding: 9px 14px;
  font-size: 14px;
  color: var(--a-color-text);
  font-family: var(--a-font);
  transition: var(--a-transition);
  width: 100%;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--a-color-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(232,96,60,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--a-color-text-muted); margin-top: 4px; }

.form-select-sm, .form-input-sm {
  padding: 6px 10px;
  font-size: 13px;
  border: 1.5px solid var(--a-color-border);
  border-radius: var(--a-radius-sm);
  background: white;
  font-family: var(--a-font);
  color: var(--a-color-text);
}
.form-select-sm:focus, .form-input-sm:focus {
  outline: none;
  border-color: var(--a-color-primary);
}

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
  background: #F9FAFB;
  border-bottom: 1px solid var(--a-color-border);
  flex-wrap: wrap;
}

.radio-group { display: flex; gap: 20px; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
.radio-text { color: var(--a-color-text); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.checkbox-text { color: var(--a-color-text); }

.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.inline-form { display: flex; flex-direction: column; }

/* Content grid */
.content-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

/* Dish Form */
.dish-form { max-width: 100%; }

/* Image Preview */
.image-preview-box {
  border: 2px dashed var(--a-color-border);
  border-radius: var(--a-radius-md);
  padding: 32px;
  text-align: center;
  transition: var(--a-transition);
  color: var(--a-color-text-muted);
  background: #F9FAFB;
  cursor: pointer;
}
.image-preview-box:hover { border-color: var(--a-color-primary); background: var(--a-color-primary-ultra-light); }
.preview-img {
  max-height: 160px;
  border-radius: var(--a-radius-md);
  margin: 0 auto 8px;
}
.current-image { margin-bottom: 8px; }
.dish-thumb-wrap { width: 48px; height: 48px; border-radius: var(--a-radius-sm); overflow: hidden; flex-shrink: 0; }
.dish-thumb { width: 100%; height: 100%; object-fit: cover; }
.dish-thumb-placeholder {
  width: 48px;
  height: 48px;
  background: var(--a-color-primary-ultra-light);
  border-radius: var(--a-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.link-muted { font-size: 12px; color: var(--a-color-text-muted); }
.link-muted:hover { color: var(--a-color-primary); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--a-radius-md);
  font-size: 14px;
  margin-bottom: 20px;
  font-weight: 500;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  background: white;
  border-radius: var(--a-radius-lg);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--a-color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
}
.modal-close { font-size: 18px; color: var(--a-color-text-muted); cursor: pointer; background: none; border: none; padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { color: var(--a-color-danger); }
.modal .inline-form { padding: 20px; }

/* Empty State */
.empty-state { text-align: center; padding: 40px; color: var(--a-color-text-muted); font-size: 14px; }

/* Quick actions card */
.quick-actions {
  background: white;
  border-radius: var(--a-radius-lg);
  padding: 20px;
  box-shadow: var(--a-shadow-card);
  border: 1px solid var(--a-color-border);
  margin-bottom: 20px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .admin-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { padding: 10px 16px; }
  .login-card { padding: 28px 24px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) { display: none; }
}
