/* ═══════════════════════════════════════════════════
   PANEL DRA. ANA MILICI — Design System
   Navy #1B2A5E · Sage #6B8F71 · Gold #C9A96E · Cream #F5F0E8
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Montserrat:wght@300;400;500;600&display=swap');

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

:root {
  --navy:  #1B2A5E;
  --navy-light: #253a80;
  --navy-dark: #111c3f;
  --sage:  #6B8F71;
  --sage-light: #8aad90;
  --sage-pale: #e8f0e9;
  --gold:  #C9A96E;
  --gold-light: #dfc090;
  --gold-pale: #f7f0e4;
  --cream: #F5F0E8;
  --cream-dark: #ede6d8;
  --white: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888aa;
  --border: #e2ddd5;
  --border-light: #f0ece4;
  --error: #c0392b;
  --error-light: #fdf0ef;
  --success: #27ae60;
  --success-light: #edfbf3;
  --warning: #e67e22;
  --warning-light: #fef9f0;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(27,42,94,0.08);
  --shadow-md: 0 4px 24px rgba(27,42,94,0.12);
  --shadow-lg: 0 8px 40px rgba(27,42,94,0.16);

  --font-title: 'Lora', Georgia, serif;
  --font-body: 'Montserrat', system-ui, sans-serif;
  --transition: 200ms ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography ───────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-title); color: var(--navy); }
h1 { font-size: 1.75rem; font-weight: 600; }
h2 { font-size: 1.375rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p { color: var(--text-secondary); font-size: 0.9rem; }

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-light);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-light);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-sage {
  background: var(--sage);
  color: var(--white);
}
.btn-sage:hover:not(:disabled) {
  background: var(--sage-light);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--navy);
  color: var(--navy);
}
.btn-outline:hover:not(:disabled) {
  background: var(--navy);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--cream-dark);
  color: var(--navy);
}

.btn-danger {
  background: transparent;
  border: 1.5px solid var(--error);
  color: var(--error);
}
.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: var(--white);
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Loading spinner in button */
.btn.loading { pointer-events: none; opacity: 0.8; }
.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ─── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27,42,94,0.08);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--cream); opacity: 0.7; }

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

.form-error { color: var(--error); font-size: 0.78rem; margin-top: 5px; }
.form-hint { color: var(--text-muted); font-size: 0.78rem; margin-top: 5px; }

/* ─── Cards ────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-sm { padding: 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.card-header h2, .card-header h3 { margin: 0; }

/* ─── Badges ───────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-navy { background: var(--navy); color: white; }
.badge-gold { background: var(--gold-pale); color: var(--gold); border: 1px solid var(--gold-light); }
.badge-sage { background: var(--sage-pale); color: var(--sage); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-muted { background: var(--cream-dark); color: var(--text-muted); }

/* ─── Tables ───────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--cream); }

/* ─── Alerts / Toasts ──────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert-error { background: var(--error-light); color: var(--error); border-left: 3px solid var(--error); }
.alert-success { background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-left: 3px solid var(--warning); }
.alert-info { background: rgba(27,42,94,0.06); color: var(--navy); border-left: 3px solid var(--navy); }

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: white;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
  max-width: 320px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-info { background: var(--navy); }

/* ─── Layout Shell (App) ───────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
}
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}
.sidebar-logo-name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-section {
  padding: 16px 0 8px;
}
.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 0 20px 8px;
}

.sidebar-nav { list-style: none; }
.sidebar-nav-item { margin: 2px 8px; }
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: none;
  transition: all var(--transition);
}
.sidebar-nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: white;
}
.sidebar-nav-link.active {
  background: rgba(201,169,110,0.18);
  color: var(--gold);
  font-weight: 500;
}
.sidebar-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }
.sidebar-nav-link.active svg { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  background: var(--gold);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-user {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(201,169,110,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 0.875rem;
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
}
.sidebar-logout {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  transition: color var(--transition);
  padding: 4px;
}
.sidebar-logout:hover { color: var(--error); }

/* ─── Topbar ───────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 6px rgba(27,42,94,0.05);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--navy);
  padding: 6px;
}

.topbar-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--navy);
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-notifications {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 8px;
  transition: background var(--transition);
}
.topbar-notifications:hover { background: var(--cream); }
.topbar-notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid white;
}

/* ─── Main Content ─────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-content {
  padding: 28px 28px;
  flex: 1;
}

/* Admin layout: .main-content is a direct child of body (no .main-wrapper) */
body > .main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* ─── Page Header ──────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left h1 { margin-bottom: 4px; }
.page-header-left p { font-size: 0.875rem; }

/* ─── Stats Grid ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-navy { background: rgba(27,42,94,0.08); color: var(--navy); }
.stat-icon-gold { background: var(--gold-pale); color: var(--gold); }
.stat-icon-sage { background: var(--sage-pale); color: var(--sage); }
.stat-icon-error { background: var(--error-light); color: var(--error); }
.stat-value {
  font-size: 1.75rem;
  font-family: var(--font-title);
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Grid Layouts ─────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-main-side { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* ─── Empty States ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 0.875rem; }

/* ─── Modals ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,42,94,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
.modal-lg { max-width: 720px; }
.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

/* ─── Login Page ───────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  text-align: center;
}
.login-logo-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--navy);
  font-weight: 600;
}
.login-logo-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Animations ───────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Utilities ────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-navy { color: var(--navy); }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.font-title { font-family: var(--font-title); }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ─── Mobile ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --topbar-h: 56px;
  }

  .sidebar {
    width: 260px;
    transform: translateX(-100%);
  }
  .sidebar.open,
  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .topbar-menu-btn { display: flex; }

  .main-wrapper { margin-left: 0; }
  .main-content { padding: 16px; }

  .grid-2, .grid-3, .grid-main-side {
    grid-template-columns: 1fr;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .page-header { flex-direction: column; }
  .page-header .btn { width: 100%; justify-content: center; }

  .login-card { padding: 28px 20px; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 95vh;
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
}
