/* ============================================================
   NatuChefs Admin — Design System
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --topbar-height: 64px;

  --color-sidebar-bg: #0f172a;
  --color-sidebar-border: #1e293b;
  --color-sidebar-text: #94a3b8;
  --color-sidebar-hover: #1e293b;
  --color-sidebar-active-bg: rgba(249, 115, 22, 0.15);
  --color-sidebar-active-text: #f97316;
  --color-sidebar-icon: #475569;

  --color-brand: #f97316;
  --color-brand-dark: #ea6c0a;
  --color-brand-light: rgba(249, 115, 22, 0.1);

  --color-bg: #f1f5f9;
  --color-card: #ffffff;
  --color-topbar: #ffffff;
  --color-border: #e2e8f0;

  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);

  --transition: 0.18s ease;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-content {
  flex: 1;
  padding: 28px 28px 40px;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  z-index: 200;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-sidebar-border);
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--color-brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--color-sidebar-text);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  list-style: none;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-sidebar-icon);
  padding: 16px 8px 6px;
}

.sidebar-nav li a,
.sidebar-nav li.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav li a:hover {
  background: var(--color-sidebar-hover);
  color: #e2e8f0;
}

.sidebar-nav li a.active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
  font-weight: 600;
}

.sidebar-nav li a .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-nav li a.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--color-sidebar-border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #ef4444;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-footer a:hover {
  background: rgba(239,68,68,0.1);
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--color-topbar);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date {
  font-size: 13px;
  color: var(--color-text-muted);
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 6px 14px 6px 8px;
}

.admin-avatar {
  width: 30px;
  height: 30px;
  background: var(--color-brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.admin-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.page-header-left p {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--color-border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.orange { background: rgba(249,115,22,0.12); color: #f97316; }
.stat-icon.green  { background: rgba(16,185,129,0.12);  color: #10b981; }
.stat-icon.blue   { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.stat-icon.purple { background: rgba(139,92,246,0.12);  color: #8b5cf6; }
.stat-icon.red    { background: rgba(239,68,68,0.12);   color: #ef4444; }
.stat-icon.amber  { background: rgba(245,158,11,0.12);  color: #f59e0b; }

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--color-text); line-height: 1.2; margin: 4px 0 6px; }
.stat-link { font-size: 12px; color: var(--color-brand); text-decoration: none; font-weight: 500; }
.stat-link:hover { text-decoration: underline; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.card-body { padding: 22px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

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

.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--color-text);
  vertical-align: middle;
}

.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: none; }

.table-img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--color-border);
}

.empty-row td {
  text-align: center;
  padding: 48px;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-success  { background: rgba(16,185,129,0.12);  color: #059669; }
.badge-warning  { background: rgba(245,158,11,0.12);  color: #d97706; }
.badge-danger   { background: rgba(239,68,68,0.12);   color: #dc2626; }
.badge-info     { background: rgba(59,130,246,0.12);  color: #2563eb; }
.badge-gray     { background: rgba(100,116,139,0.12); color: #475569; }
.badge-orange   { background: rgba(249,115,22,0.12);  color: #ea580c; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary    { background: var(--color-brand); color: #fff; }
.btn-primary:hover { background: var(--color-brand-dark); color: #fff; }

.btn-secondary  { background: #e2e8f0; color: var(--color-text); }
.btn-secondary:hover { background: #cbd5e1; color: var(--color-text); }

.btn-success    { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger     { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning    { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-outline    { background: transparent; border: 1.5px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); color: var(--color-text); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px 10px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-section { margin-bottom: 28px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.form-control,
.form-select {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--color-text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  outline: none;
  line-height: 1.5;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

.form-text { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--color-danger); margin-top: 4px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  margin-top: 24px;
}

/* ── Detail List (view pages) ───────────────────────────── */
.detail-list { list-style: none; }
.detail-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}
.detail-list li:last-child { border-bottom: none; }
.detail-key {
  width: 160px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 13px;
}
.detail-val { color: var(--color-text); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: rgba(16,185,129,0.10); color: #065f46; border: 1px solid rgba(16,185,129,0.25); }
.alert-danger  { background: rgba(239,68,68,0.10);  color: #991b1b; border: 1px solid rgba(239,68,68,0.25); }
.alert-warning { background: rgba(245,158,11,0.10); color: #92400e; border: 1px solid rgba(245,158,11,0.25); }
.alert-info    { background: rgba(59,130,246,0.10); color: #1e3a8a; border: 1px solid rgba(59,130,246,0.25); }

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--color-sidebar-bg);
}

.login-brand-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  position: relative;
  overflow: hidden;
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: rgba(249,115,22,0.08);
  border-radius: 50%;
}

.login-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 240px;
  height: 240px;
  background: rgba(249,115,22,0.06);
  border-radius: 50%;
}

.login-brand-logo {
  width: 72px;
  height: 72px;
  background: var(--color-brand);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
  box-shadow: 0 8px 24px rgba(249,115,22,0.3);
}

.login-brand-title {
  font-size: 28px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 8px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-brand-desc {
  font-size: 14px;
  color: var(--color-sidebar-text);
  text-align: center;
  max-width: 300px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.login-form-panel {
  width: 440px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.login-form-inner { width: 100%; }

.login-form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.login-form-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 32px;
}

.login-form .form-group { margin-bottom: 20px; }

.login-submit {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  justify-content: center;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
  }
  .sidebar-overlay.active { display: block; }
  .mobile-menu-btn { display: flex !important; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { width: 100%; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 580px) {
  .admin-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stat-cards { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Utilities ───────────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  cursor: pointer;
  color: var(--color-text);
  font-size: 15px;
}

.text-muted  { color: var(--color-text-muted); }
.text-right  { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 24px; }
.action-btns { display: flex; gap: 6px; align-items: center; }

/* Bootstrap overrides for compatibility */
.btn.btn-primary   { background: var(--color-brand) !important; border-color: var(--color-brand) !important; color:#fff !important; }
.btn.btn-primary:hover { background: var(--color-brand-dark) !important; border-color: var(--color-brand-dark) !important; }
.btn.btn-warning   { background: #f59e0b !important; border-color:#f59e0b !important; color:#fff !important; }
.btn.btn-warning:hover { background: #d97706 !important; border-color:#d97706 !important; }
.btn.btn-danger    { background: #ef4444 !important; border-color:#ef4444 !important; color:#fff !important; }
.btn.btn-danger:hover  { background: #dc2626 !important; border-color:#dc2626 !important; }
.btn.btn-secondary { background: #e2e8f0 !important; border-color:#e2e8f0 !important; color:var(--color-text) !important; }
.btn.btn-secondary:hover { background:#cbd5e1 !important; border-color:#cbd5e1 !important; }
.btn.btn-success   { background: #10b981 !important; border-color:#10b981 !important; color:#fff !important; }
.btn.btn-success:hover { background:#059669 !important; border-color:#059669 !important; }

.form-control:focus, .form-select:focus {
  border-color: var(--color-brand) !important;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12) !important;
}
