:root {
  --navy: #0E2A47;
  --navy-dark: #071728;
  --blue: #1D6FD8;
  --blue-hover: #155bb5;
  --sky: #3FB6E8;
  --maroon: #7A1F2B;
  --maroon-hover: #631923;
  --gold: #EFA23B;
  --green: #10b981;
  --red: #ef4444;
  --paper: #F8FAFC;
  --card-bg: #FFFFFF;
  --line: #E2E8F0;
  --ink: #0F172A;
  --ink-soft: #64748B;
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 36px -8px rgba(15, 23, 42, 0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── LOGIN SCREEN ─── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(29, 111, 216, 0.15), transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(122, 31, 43, 0.12), transparent 40%),
              var(--navy);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-wrap {
  width: 68px;
  height: 68px;
  background: var(--navy);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 10px 24px -6px rgba(14, 42, 71, 0.4);
}
.login-logo-wrap img { width: 44px; height: 44px; object-fit: contain; }
.login-header h1 { font-size: 1.45rem; font-weight: 700; color: var(--navy); }
.login-header p { font-size: 0.88rem; color: var(--ink-soft); margin-top: 4px; }

/* ─── ADMIN LAYOUT ─── */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; }
.sidebar-brand h2 { font-size: 1.05rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.sidebar-brand small { font-size: 0.68rem; color: var(--sky); text-transform: uppercase; letter-spacing: 0.1em; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #CBD5E1;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.18s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 6px 16px -4px rgba(29, 111, 216, 0.5); }
.nav-item .icon { font-size: 1.15rem; width: 22px; text-align: center; }
.nav-item .badge {
  margin-left: auto;
  background: var(--maroon);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 0.85rem; }
.user-details h4 { font-size: 0.85rem; color: #fff; font-weight: 600; }
.user-details small { font-size: 0.72rem; color: #94A3B8; }

/* MAIN CONTENT */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.top-navbar {
  height: 68px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}
.top-title h2 { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.mobile-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--navy); }

.content-area {
  flex: 1;
  padding: 32px;
  max-width: 1300px;
  width: 100%;
}

/* ─── TAB PANELS ─── */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── STATS GRID ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: #EFF6FF;
  color: var(--blue);
}
.stat-info h3 { font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-info p { font-size: 0.85rem; color: var(--ink-soft); margin-top: 4px; font-weight: 500; }

/* ─── CARD CONTAINERS ─── */
.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 28px;
}
.admin-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-card-title h3 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.admin-card-title p { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-maroon { background: var(--maroon); color: #fff; }
.btn-maroon:hover { background: var(--maroon-hover); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--paper); border-color: #CBD5E1; }
.btn-danger { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }
.btn-danger:hover { background: #FCA5A5; color: #991B1B; }
.btn-success { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.btn-success:hover { background: #86EFAC; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }

/* ─── TABLES ─── */
.table-responsive { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.88rem; }
.admin-table th { background: var(--paper); color: var(--ink-soft); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 16px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #F8FAFC; }

.table-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #E2E8F0; }
.table-img-circle { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #E2E8F0; }

.badge-status { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-active { background: #DCFCE7; color: #166534; }
.badge-inactive { background: #F1F5F9; color: #64748B; }
.badge-new { background: #DBEAFE; color: #1E40AF; }
.badge-contacted { background: #FEF3C7; color: #92400E; }
.badge-enrolled { background: #DCFCE7; color: #166534; }

/* ─── FORMS & INPUTS ─── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29, 111, 216, 0.1); }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* IMAGE UPLOADER PREVIEW */
.img-upload-box {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--paper);
  position: relative;
}
.img-upload-box:hover { border-color: var(--blue); background: #EFF6FF; }
.img-upload-preview { max-height: 140px; max-width: 100%; border-radius: 8px; margin-top: 10px; display: none; object-fit: contain; }

/* ─── MODALS ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 42, 71, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  transition: transform 0.2s ease;
}
.modal-backdrop.show .modal-card { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.15rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.4rem; color: var(--ink-soft); cursor: pointer; line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--paper); }

/* ─── TOAST NOTIFICATIONS ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 10px 28px -6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.25s ease;
  min-width: 280px;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* RESPONSIVE */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .mobile-toggle { display: block; }
  .content-area { padding: 20px; }
}
