/* ============================================================
   PAS — Policy Administration System
   Main Stylesheet (compiled from SCSS)
   Palette: Deep Navy #0f2a4e | Charcoal #374151 | Teal #10b981
   Font: Inter (loaded via Google Fonts)
   ============================================================ */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --navy:        #0f2a4e;
  --navy-light:  #1a3d6e;
  --navy-dark:   #091d38;
  --teal:        #10b981;
  --teal-dark:   #059669;
  --teal-light:  #d1fae5;
  --charcoal:    #374151;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-500:    #6b7280;
  --gray-700:    #374151;
  --gray-900:    #111827;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --info:        #3b82f6;
  --purple:      #8b5cf6;
  --font-base:   'Inter', 'Ubuntu', system-ui, sans-serif;
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --sidebar-w:   260px;
  --sidebar-collapsed: 70px;
  --header-h:    60px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
  --transition:  all .2s ease;
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-base);
  background: var(--gray-100);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--teal); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--teal-dark); }
h1,h2,h3,h4,h5,h6 { color: var(--navy); font-weight: 600; line-height: 1.3; }
p { margin-bottom: 1rem; }
table { font-size: .875rem; }

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

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--teal);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px; color: #fff;
}
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: var(--radius-sm); flex-shrink: 0; }
.brand-name { color: #fff; font-size: .95rem; font-weight: 700; white-space: nowrap; letter-spacing: .3px; }
.sidebar.collapsed .brand-name { display: none; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--teal); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { overflow: hidden; }
.user-name { color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.5); font-size: .72rem; white-space: nowrap; }
.sidebar.collapsed .user-info { display: none; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-label {
  padding: 8px 18px 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}
.sidebar.collapsed .nav-label { display: none; }

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.65);
  border-radius: 0;
  transition: var(--transition);
  white-space: nowrap;
  font-size: .87rem;
}
.sidebar-nav .nav-link i { font-size: 16px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--teal); color: #fff; font-weight: 600; }
.sidebar.collapsed .nav-link span { display: none; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.55);
  font-size: .85rem; transition: var(--transition);
}
.btn-logout:hover { color: var(--danger); }
.sidebar.collapsed .btn-logout span { display: none; }

/* ─── Main Area ──────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky; top: 0; z-index: 900;
  box-shadow: var(--shadow-sm);
}
.topbar-toggle { background: none; border: none; cursor: pointer; color: var(--gray-500); font-size: 20px; padding: 4px; }
.topbar-toggle:hover { color: var(--navy); }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--navy); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-notif {
  position: relative; background: none; border: none;
  color: var(--gray-500); font-size: 20px; cursor: pointer;
  padding: 4px 8px; border-radius: var(--radius-sm);
}
.topbar-notif:hover { background: var(--gray-100); color: var(--navy); }
.notif-badge {
  position: absolute; top: 0; right: 0;
  width: 18px; height: 18px;
  background: var(--danger); color: #fff;
  border-radius: 50%; font-size: 10px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

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

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card.navy    { border-left-color: var(--navy); }
.stat-card.teal    { border-left-color: var(--teal); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.purple  { border-left-color: var(--purple); }
.stat-card.info    { border-left-color: var(--info); }

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.navy    { background: rgba(15,42,78,.1);   color: var(--navy); }
.stat-icon.teal    { background: var(--teal-light);    color: var(--teal-dark); }
.stat-icon.warning { background: #fef3c7;              color: var(--warning); }
.stat-icon.danger  { background: #fee2e2;              color: var(--danger); }
.stat-icon.purple  { background: #ede9fe;              color: var(--purple); }
.stat-icon.info    { background: #dbeafe;              color: var(--info); }
.stat-body { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--gray-500); margin-top: 4px; }
.stat-delta { font-size: .75rem; font-weight: 600; }
.stat-delta.up   { color: var(--teal); }
.stat-delta.down { color: var(--danger); }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header .card-title {
  font-size: .95rem; font-weight: 600;
  color: var(--navy); margin: 0;
}
.card-body { padding: 20px; }

/* ─── Policy Status Badges ───────────────────────────────────── */
.badge-policy { font-size: .72rem; padding: 4px 9px; border-radius: 20px; font-weight: 600; }
.badge-policy.badge-success   { background: #d1fae5; color: #065f46; }
.badge-policy.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-policy.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-policy.badge-purple    { background: #ede9fe; color: #5b21b6; }
.badge-policy.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-policy.badge-secondary { background: var(--gray-100); color: var(--gray-500); }
.badge-policy.badge-teal      { background: var(--teal-light); color: var(--teal-dark); }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-responsive { border-radius: var(--radius); overflow: hidden; }
.table { font-size: .85rem; margin: 0; }
.table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.table td { padding: 12px 14px; vertical-align: middle; border-color: var(--gray-100); }
.table tbody tr:hover { background: var(--gray-50); }
.table-actions { display: flex; gap: 6px; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn { border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; transition: var(--transition); }
.btn-navy { background: var(--navy); color: #fff; border: none; }
.btn-navy:hover { background: var(--navy-light); color: #fff; }
.btn-teal { background: var(--teal); color: #fff; border: none; }
.btn-teal:hover { background: var(--teal-dark); color: #fff; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-label { font-size: .82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
.form-control, .form-select {
  font-size: .87rem; border-color: var(--gray-300);
  border-radius: var(--radius-sm); transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(16,185,129,.15);
}
.form-text { font-size: .75rem; color: var(--gray-500); }
.input-group-text { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-500); }

/* ─── Auth Pages ─────────────────────────────────────────────── */
.auth-page { background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--teal-dark) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-header { background: var(--navy); padding: 28px 32px 24px; text-align: center; }
.auth-logo { width: 48px; height: 48px; background: var(--teal); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; font-size: 24px; color: #fff; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius); }
.auth-title { color: #fff; font-size: 1.25rem; font-weight: 700; margin: 0 0 4px; }
.auth-subtitle { color: rgba(255,255,255,.6); font-size: .82rem; margin: 0; }
.auth-body { padding: 28px 32px; }
.auth-footer { background: var(--gray-50); padding: 14px 32px; text-align: center; font-size: .8rem; color: var(--gray-500); border-top: 1px solid var(--gray-200); }

/* OTP input */
.otp-inputs { display: flex; gap: 10px; justify-content: center; }
.otp-inputs input {
  width: 48px; height: 56px; text-align: center; font-size: 1.4rem; font-weight: 700;
  border: 2px solid var(--gray-300); border-radius: var(--radius-sm);
  transition: var(--transition);
}
.otp-inputs input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(16,185,129,.15); outline: none; }

/* ─── Sidebar Toggle (mobile) ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }
  .sidebar-overlay.visible { display: block; }
}

/* ─── Mobile Field Agent UI ──────────────────────────────────── */
.mobile-action-btn {
  width: 100%; padding: 18px; font-size: 1rem; font-weight: 700;
  border-radius: var(--radius); margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.mobile-action-btn i { font-size: 26px; }

/* ─── Charts ─────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; }

/* ─── Search & Filter Bar ────────────────────────────────────── */
.filter-bar {
  background: #fff;
  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-control,
.filter-bar .form-select { font-size: .83rem; }

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination-wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; font-size: .82rem; color: var(--gray-500); }
.page-link { border-radius: var(--radius-sm) !important; color: var(--navy); }
.page-item.active .page-link { background: var(--navy); border-color: var(--navy); }

/* ─── Member Profile (One-Page View) ────────────────────────── */
.member-profile-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 28px 20px;
  color: #fff;
}
.member-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--teal); border: 3px solid rgba(255,255,255,.3);
  font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.member-name { font-size: 1.2rem; font-weight: 700; margin: 0; }
.member-meta { font-size: .8rem; opacity: .75; }

/* ─── Modals ─────────────────────────────────────────────────── */
.modal-header { background: var(--navy); color: #fff; }
.modal-header .btn-close { filter: invert(1); }
.modal-title { font-size: .95rem; font-weight: 600; }

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); font-size: .85rem; border-left: 4px solid transparent; }
.alert-success { border-left-color: var(--teal); }
.alert-danger  { border-left-color: var(--danger); }
.alert-warning { border-left-color: var(--warning); }
.alert-info    { border-left-color: var(--info); }

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-500); }
.empty-state i { font-size: 48px; color: var(--gray-300); display: block; margin-bottom: 12px; }
.empty-state h5 { font-size: .95rem; font-weight: 600; color: var(--gray-700); }
.empty-state p { font-size: .82rem; }

/* ─── Loading spinner ────────────────────────────────────────── */
.spinner-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.7); z-index: 9999; display: none; align-items: center; justify-content: center; }
.spinner-overlay.show { display: flex; }

/* ─── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .filter-bar, .btn, .pagination-wrap { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
