/* ─── Imports ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Variables ──────────────────────────────────────────────────────── */
:root {
  --saffron: #FF6B00;
  --saffron-light: #FF8C33;
  --saffron-pale: #FFF0E0;
  --navy: #0D1B2A;
  --navy-mid: #1B2D40;
  --navy-light: #2A3F56;
  --green: #138808;
  --green-light: #1AA30A;
  --teal: #0E7C7B;
  --gold: #F4C430;
  --white: #FFFFFF;
  --off-white: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-500: #ADB5BD;
  --gray-700: #495057;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--gray-100);
  color: var(--navy);
  min-height: 100vh;
  margin: 0;
}

code, .mono { font-family: 'JetBrains Mono', monospace; }

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

/* ─── Layout ─────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.brand-logo img {
    width: 43px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.brand-text {
  line-height: 1.2;
}

.brand-text .title {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
}

.brand-text .subtitle {
  font-size: 10px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray-500);
  padding: 12px 12px 6px;
  margin-top: 8px;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65) !important;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white) !important;
}

.nav-link.active {
  background: linear-gradient(135deg, var(--saffron), var(--saffron-light));
  color: var(--white) !important;
  box-shadow: 0 4px 12px rgba(255,107,0,0.3);
}

.nav-link .nav-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.07);
  font-size: 15px;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-link.active .nav-icon {
  background: rgba(255,255,255,0.2);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--white);
}

.user-role {
  font-size: 11px;
  color: var(--gray-500);
}

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

/* ─── Top Header ─────────────────────────────────────────────────────── */
.top-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 20px;
  color: var(--navy);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Page Body ──────────────────────────────────────────────────────── */
.page-body {
  flex: 1;
  padding: 24px;
}

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

.card-header {
  background: none;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.card-header h5, .card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  color: var(--white);
  transition: var(--transition);
}

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

.stat-card.orange { background: linear-gradient(135deg, #FF6B00, #FF9A3C); }
.stat-card.blue   { background: linear-gradient(135deg, #1B4F72, #2E86C1); }
.stat-card.green  { background: linear-gradient(135deg, #138808, #27AE60); }
.stat-card.teal   { background: linear-gradient(135deg, #0E7C7B, #1ABC9C); }

.stat-card .stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  opacity: 0.85;
  font-weight: 500;
}

.stat-card .stat-bg {
  position: absolute;
  right: -20px; bottom: -20px;
  font-size: 80px;
  opacity: 0.1;
}

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

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

.table th {
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--navy);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--saffron-pale); }

/* ─── Badges ─────────────────────────────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.badge-male    { background: #E3F2FD; color: #1565C0; }
.badge-female  { background: #FCE4EC; color: #AD1457; }
.badge-other   { background: #F3E5F5; color: #6A1B9A; }
.badge-active  { background: #E8F5E9; color: #2E7D32; }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--saffron), var(--saffron-light));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(255,107,0,0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #e55f00, var(--saffron));
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255,107,0,0.4);
}

.btn-navy {
  background: var(--navy);
  color: var(--white);
}

.btn-navy:hover { background: var(--navy-mid); color: var(--white); }

.btn-success {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: var(--white);
}

.btn-outline-saffron {
  border: 1.5px solid var(--saffron);
  color: var(--saffron);
  background: none;
}

.btn-outline-saffron:hover {
  background: var(--saffron);
  color: var(--white);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 6px 10px; line-height: 1; }

/* ─── Forms ──────────────────────────────────────────────────────────── */
.form-control, .form-select {
  font-family: 'Sora', sans-serif;
  font-size: 13.5px;
  padding: 9px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  color: var(--navy);
  background: var(--white);
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--saffron);
  box-shadow: 0 0 0 3px rgba(255,107,0,0.12);
  outline: none;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

/* ─── Modals ─────────────────────────────────────────────────────────── */
.modal-content {
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 20px;
}

.modal-header .modal-title { font-size: 15px; font-weight: 700; }
.modal-header .btn-close { filter: invert(1); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); }

/* ─── Search & Filter Bar ────────────────────────────────────────────── */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-bar .form-group { flex: 1; min-width: 160px; margin: 0; }

/* ─── Pagination ─────────────────────────────────────────────────────── */
.pagination .page-link {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  color: var(--navy);
  border-color: var(--gray-200);
  padding: 7px 13px;
}

.pagination .page-item.active .page-link {
  background: var(--saffron);
  border-color: var(--saffron);
  color: var(--white);
}

.pagination .page-link:hover { background: var(--saffron-pale); color: var(--saffron); }

/* ─── Flash Messages ─────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  padding: 12px 16px;
  border: none;
}

.alert-success { background: #E8F5E9; color: #2E7D32; }
.alert-danger   { background: #FFEBEE; color: #C62828; }
.alert-warning  { background: #FFF8E1; color: #F57F17; }
.alert-info     { background: #E3F2FD; color: #1565C0; }

/* ─── Phone/WhatsApp Links ───────────────────────────────────────────── */
.phone-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-weight: 600;
  font-size: 13px;
}

.wa-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #25D366;
  font-size: 12px;
  font-weight: 500;
}

.maps-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #4285F4;
  font-size: 12px;
}

/* ─── Login Page ─────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, #1a3a5c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,107,0,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(19,136,8,0.06) 0%, transparent 50%);
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(255,107,0,0.35);
}

.login-logo img {
    width: 80px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 28px;
}

/* ─── Tricolor Accent ────────────────────────────────────────────────── */
.tricolor-bar {
  height: 4px;
  background: linear-gradient(to right, var(--saffron) 33%, var(--white) 33%, var(--white) 66%, var(--green) 66%);
  border-radius: 2px;
  margin-bottom: 20px;
}

/* ─── Empty State ────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h5 { color: var(--gray-700); font-size: 16px; margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; margin-bottom: 20px; }

/* ─── Sidebar Overlay ────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1039;
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; }

  .menu-toggle { display: flex; align-items: center; }

  .page-body { padding: 16px; }

  .filter-bar { padding: 12px 14px; gap: 8px; }
  .filter-bar .form-group { min-width: 130px; }

  .stat-card .stat-value { font-size: 26px; }
}

@media (max-width: 575px) {
  .login-card { padding: 28px 20px; }
  .page-body { padding: 12px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .btn { font-size: 12.5px; padding: 7px 14px; }
  .table th, .table td { padding: 10px 12px; font-size: 12.5px; }
}

/* ─── Animations ──────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.fade-in { animation: fadeIn 0.35s ease both; }

.stat-card:nth-child(1) { animation: fadeIn 0.3s 0.05s ease both; }
.stat-card:nth-child(2) { animation: fadeIn 0.3s 0.1s ease both; }
.stat-card:nth-child(3) { animation: fadeIn 0.3s 0.15s ease both; }
.stat-card:nth-child(4) { animation: fadeIn 0.3s 0.2s ease both; }

/* ─── Utilities ──────────────────────────────────────────────────────── */
.text-saffron { color: var(--saffron) !important; }
.text-navy    { color: var(--navy) !important; }
.text-green   { color: var(--green) !important; }
.bg-saffron   { background: var(--saffron) !important; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.fs-12        { font-size: 12px; }
.fs-13        { font-size: 13px; }
.gap-8        { gap: 8px; }
