/* ============================================
   LIGHT MODE — ADMIN
   ============================================ */
body.light-mode .sidebar { background:#f0ebe2; border-right-color:#ddd5c5; }
body.light-mode .sidebar-brand { color:#b8860b; }
body.light-mode .sidebar-link { color:#5a4a30; }
body.light-mode .sidebar-link:hover,
body.light-mode .sidebar-link.active { background:rgba(184,134,11,0.08); color:#b8860b; border-left-color:#b8860b; }
body.light-mode .admin-topbar { background:rgba(247,243,237,0.97); border-bottom-color:#ddd5c5; }
body.light-mode .topbar-title { color:#2a1f10; }
body.light-mode .stat-card { background:#fff; border-color:#ddd5c5; }
body.light-mode .stat-value { color:#2a1f10; }
body.light-mode .chart-card { background:#fff; border-color:#ddd5c5; }
body.light-mode .table-card { background:#fff; border-color:#ddd5c5; }
body.light-mode .data-table th { background:#f0ebe2; color:#8a7a60; border-bottom-color:#ddd5c5; }
body.light-mode .data-table td { color:#5a4a30; border-bottom-color:#eee8df; }
body.light-mode .data-table tbody tr:hover td { background:rgba(184,134,11,0.04); color:#2a1f10; }
body.light-mode .table-search,
body.light-mode .filter-select { background:#f7f3ed; border-color:#ddd5c5; color:#2a1f10; }
body.light-mode .modal { background:#fff; border-color:#ddd5c5; }
body.light-mode .login-card { background:#fff; border-color:#ddd5c5; }
body.light-mode .login-page { background: radial-gradient(ellipse at 20% 20%,rgba(184,134,11,0.06) 0%,transparent 50%), #f7f3ed; }
body.light-mode .sidebar-footer { border-top-color:#ddd5c5; }
body.light-mode .admin-name { color:#2a1f10; }
body.light-mode .upload-wrap { border-color:#ddd5c5; }
body.light-mode .upload-wrap:hover { background:rgba(184,134,11,0.04); }
body.light-mode .admin-avatar { color:#fff; }

/* ============================================
   Admin Dashboard Styles
   ============================================ */

/* ---- ADMIN LAYOUT ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: var(--transition);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  color: var(--gold-light);
  font-weight: 300;
}

.sidebar-brand span { display: block; font-size: 0.7rem; color: var(--text-muted); font-family: 'DM Sans', sans-serif; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
  min-height: 0;
}

.nav-section-label {
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: rgba(201,168,76,0.06);
  color: var(--gold-light);
  border-left-color: var(--gold-dim);
}

.sidebar-link.active {
  background: rgba(201,168,76,0.1);
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.sidebar-link .icon {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  margin-top: auto;
}

.admin-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}

.admin-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--bg-primary);
  font-weight: 600;
}

.admin-name { font-size: 0.875rem; color: var(--text-primary); }
.admin-role { font-size: 0.75rem; color: var(--text-muted); }

/* ---- MAIN CONTENT ---- */
.admin-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: rgba(14,12,10,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: var(--cream);
  font-weight: 300;
}

.topbar-actions { display: flex; gap: 0.75rem; align-items: center; }

.admin-content { padding: 2rem; flex: 1; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-dim));
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover::after { opacity: 1; }

.stat-icon {
  width: 44px;
  height: 44px;
  background: rgba(201,168,76,0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  color: var(--cream);
  font-weight: 300;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- CHARTS GRID ---- */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.chart-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--cream);
  font-weight: 400;
}

.chart-wrap { position: relative; height: 260px; }

/* ---- DATA TABLE ---- */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.table-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--cream);
  font-weight: 400;
}

.table-search {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  width: 220px;
  transition: var(--transition);
}

.table-search:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.table-search::placeholder { color: var(--text-muted); }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td {
  background: rgba(201,168,76,0.03);
  color: var(--text-primary);
}

.table-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
}

.table-actions { display: flex; gap: 0.5rem; }

/* ---- BADGE ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge-gold {
  background: rgba(201,168,76,0.15);
  color: var(--gold-light);
  border: 1px solid rgba(201,168,76,0.3);
}

/* ---- IMAGE UPLOAD ---- */
.upload-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.upload-wrap:hover {
  border-color: var(--gold-dim);
  background: rgba(201,168,76,0.04);
}

.upload-wrap.dragover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.08);
}

.upload-icon { font-size: 2.5rem; opacity: 0.4; margin-bottom: 0.75rem; }
.upload-text { color: var(--text-secondary); font-size: 0.875rem; }
.upload-hint { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.3rem; }
.upload-wrap input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.img-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  display: none;
}

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold-dim);
}

/* ---- STARS CELL ---- */
.stars-cell {
  display: flex;
  gap: 2px;
  align-items: center;
}

.stars-cell .s { color: var(--text-muted); font-size: 0.8rem; }
.stars-cell .s.on { color: var(--gold); }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  border-top: 1px solid var(--border);
}

.page-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover, .page-btn.active {
  border-color: var(--border-gold);
  color: var(--gold-light);
  background: rgba(201,168,76,0.1);
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(201,168,76,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(201,168,76,0.05) 0%, transparent 50%),
    var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .brand-icon {
  width: 56px;
  height: 56px;
  font-size: 24px;
  margin: 0 auto 1rem;
}

.login-logo h2 { color: var(--cream); }
.login-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.3rem; }

.error-msg {
  background: rgba(192,57,43,0.15);
  border: 1px solid rgba(192,57,43,0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #e74c3c;
  margin-bottom: 1.25rem;
  display: none;
}

.error-msg.show { display: block; }

/* ---- RESPONSIVE ADMIN ---- */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ---- SIDEBAR BACKDROP ---- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 425px) {
  /* Bottom sheet sidebar */
  .sidebar {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 50% !important;
    border-radius: 20px 20px 0 0 !important;
    transform: translateY(100%) !important;
    border-right: none !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4) !important;
  }
  .sidebar.open {
    transform: translateY(0) !important;
  }

  /* drag handle at top of bottom sheet */
  .sidebar-header::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 12px;
  }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 1rem; }
}

/* ---- CLICKABLE FEEDBACK ROW ---- */
.feedback-row {
  cursor: pointer;
  transition: background 0.15s ease;
}
.feedback-row:hover td {
  background: rgba(201,168,76,0.06) !important;
}
.feedback-row:active td {
  background: rgba(201,168,76,0.12) !important;
}

/* ---- ADMIN RESPONSIVE 425/375 ---- */
@media (max-width: 425px) {
  /* prevent any horizontal overflow */
  .admin-layout,
  .admin-main,
  .admin-content { max-width: 100vw; overflow-x: hidden; }
   .admin-title{display: none;}
  .admin-topbar { padding: 0 0.75rem; height: 56px; gap: 0.5rem; }
  .topbar-actions { gap: 0.4rem; }

  /* shrink the topbar user badge — hide full name, show initials only */
  .topbar-actions > div:first-child {
    display: flex !important;
    padding: 5px 8px !important;
    gap: 4px !important;
  }
  .topbar-actions > div:first-child span {
    display: none !important;
  }

  /* hide Dark label on theme toggle */
  .theme-switch-label { display: none !important; }

  /* shrink Add Restaurant button */
  .topbar-actions .btn-gold {
    padding: 6px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
  }

  .admin-content { padding: 0.75rem; }

  /* stats: 2-col grid, no overflow */
  .stats-grid { gap: 0.5rem; grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 0.85rem 0.75rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: 0.7rem; }
  .stat-icon { width: 36px; height: 36px; font-size: 1rem; margin-bottom: 0.6rem; }

  /* charts */
  .charts-grid { gap: 0.6rem; }
  .chart-card { padding: 0.85rem; }
  .chart-title { font-size: 0.9rem; }

  /* tables: block layout, no horizontal scroll */
  .table-card { border-radius: var(--radius-sm); overflow: hidden; }
  .table-header {
    padding: 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .table-title { font-size: 0.95rem; }
  .filter-bar { flex-direction: column; gap: 0.4rem; width: 100%; }
  .table-search,
  .filter-select { width: 100%; box-sizing: border-box; }

  /* make table scroll internally, not the whole page */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 480px; }
  .data-table th,
  .data-table td { padding: 0.6rem 0.55rem; font-size: 0.76rem; }
  .table-actions { gap: 0.25rem; flex-wrap: wrap; }
  .btn-sm { padding: 5px 9px; font-size: 0.73rem; }

  .sidebar { width: 240px; }

  /* sidebar footer — fix logout overflow */
  .sidebar-footer {
    padding: 0.75rem !important;
    margin-top: auto !important;
  }
  .sidebar-footer .admin-name {
    font-size: 0.78rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
  .sidebar-footer .admin-email,
  .sidebar-footer [style*="font-size:0.75rem"],
  .sidebar-footer [style*="font-size: 0.75rem"] {
    display: none !important;
  }
  .sidebar-footer .btn { margin-top: 0.5rem !important; }

  /* modal fits viewport */
  .modal { margin: 0.75rem; max-height: calc(100vh - 1.5rem); overflow-y: auto; }
}

@media (max-width: 375px) {
  .admin-layout,
  .admin-main,
  .admin-content { max-width: 100vw; overflow-x: hidden; }

  .admin-content { padding: 0.6rem; }

  /* topbar — hide name, show initials only */
  .topbar-actions > div:first-child {
    display: flex !important;
    padding: 4px 6px !important;
  }
  .topbar-actions > div:first-child span { display: none !important; }
  .theme-switch-label { display: none !important; }
  .topbar-actions .btn-gold {
    padding: 5px 7px !important;
    font-size: 0.7rem !important;
  }

  .stats-grid { gap: 0.4rem; }
  .stat-card { padding: 0.75rem 0.6rem; }
  .stat-value { font-size: 1.3rem; }
  .stat-label { font-size: 0.65rem; }
  .stat-icon { width: 30px; height: 30px; font-size: 0.9rem; margin-bottom: 0.5rem; }

  .chart-card { padding: 0.7rem; }

  .table-header { padding: 0.6rem; }
  .data-table { min-width: 440px; }
  .data-table th,
  .data-table td { padding: 0.5rem 0.45rem; font-size: 0.72rem; }

  .sidebar { width: 210px; }

  /* sidebar footer — fix logout overflow */
  .sidebar-footer {
    padding: 0.6rem !important;
    margin-top: auto !important;
  }
  .sidebar-footer .admin-name {
    font-size: 0.75rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
  }
  .sidebar-footer .admin-email,
  .sidebar-footer [style*="font-size:0.75rem"],
  .sidebar-footer [style*="font-size: 0.75rem"] {
    display: none !important;
  }

  .topbar-title { font-size: 0.95rem; }
  .btn-sm { padding: 4px 8px; font-size: 0.7rem; }
}