/* ============================================================
   LIC PolicyPro — Main Stylesheet
   Design: Professional navy/gold with clean card layout
   ============================================================ */

:root {
  --navy:        #0A2647;
  --navy-mid:    #144272;
  --navy-light:  #205295;
  --gold:        #F5A623;
  --gold-light:  #FBC531;
  --white:       #ffffff;
  --bg:          #F0F4F9;
  --card-bg:     #ffffff;
  --text:        #1a2535;
  --text-muted:  #6b7a99;
  --border:      #dde3f0;
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      14px;
  --shadow:      0 2px 16px rgba(10,38,71,.08);
  --shadow-lg:   0 8px 32px rgba(10,38,71,.14);
  --font:        'Plus Jakarta Sans', sans-serif;
  --mono:        'JetBrains Mono', monospace;
  /* Status colors */
  --active:      #10b981;
  --lapsed:      #ef4444;
  --closed:      #6b7a99;
  --surrendered: #f59e0b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

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

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

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

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

.brand-name { font-size: 18px; font-weight: 800; color: var(--white); display: block; line-height: 1.1; }
.brand-sub  { font-size: 10px; font-weight: 500; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .08em; }

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

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  padding: 16px 8px 6px;
  list-style: none;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.65);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}

.sidebar-nav .nav-link i { font-size: 17px; flex-shrink: 0; }

.sidebar-nav .nav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,.08);
}

.sidebar-nav .nav-link.active {
  color: var(--gold-light);
  background: rgba(251,197,49,.12);
  font-weight: 600;
}

.sidebar-nav .nav-link.active i { color: var(--gold-light); }

.nav-badge {
  margin-left: auto;
  background: var(--lapsed);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

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

.agent-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
}

.agent-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold), #e8952a);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--navy); flex-shrink: 0;
}

.agent-name  { font-size: 13px; font-weight: 600; color: var(--white); display: block; }
.agent-role  { font-size: 10px; color: rgba(255,255,255,.4); display: block; }

/* ── Layout ────────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
}

.sidebar-toggle {
  display: none;
  background: none; border: none;
  font-size: 22px; color: var(--navy);
  cursor: pointer; padding: 4px 8px;
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--navy); flex: 1; }

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

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--navy);
  font-size: 18px;
  text-decoration: none;
  transition: background .2s;
}

.topbar-btn:hover { background: var(--border); color: var(--navy); }

.notif-dot {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--lapsed);
  color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 99px;
  padding: 1px 5px;
  line-height: 14px;
}

.topbar-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--navy-mid), var(--navy-light));
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
}

/* ── Content ───────────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 28px 28px 40px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header-custom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
  margin-bottom: 16px;
}

.card-title-custom {
  font-size: 15px; font-weight: 700; color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex; flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

.stat-card.total::before  { background: linear-gradient(90deg, var(--navy-mid), var(--navy-light)); }
.stat-card.active::before { background: linear-gradient(90deg, var(--active), #34d399); }
.stat-card.lapsed::before { background: linear-gradient(90deg, var(--lapsed), #f87171); }
.stat-card.alert::before  { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.stat-card.total  .stat-icon { background: rgba(20,66,114,.1);  color: var(--navy-mid); }
.stat-card.active .stat-icon { background: rgba(16,185,129,.1); color: var(--active); }
.stat-card.lapsed .stat-icon { background: rgba(239,68,68,.1);  color: var(--lapsed); }
.stat-card.alert  .stat-icon { background: rgba(245,166,35,.1); color: var(--gold); }

.stat-value { font-size: 32px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Status Badges ─────────────────────────────────────────── */
.status-badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .05em;
}

.badge-active      { background: rgba(16,185,129,.12); color: #059669; }
.badge-lapsed      { background: rgba(239,68,68,.12);  color: #dc2626; }
.badge-closed      { background: rgba(107,122,153,.12);color: #6b7a99; }
.badge-surrendered { background: rgba(245,158,11,.12); color: #b45309; }

/* ── Tables ────────────────────────────────────────────────── */
.table-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.table-wrapper { overflow-x: auto; }

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

.lic-table thead th {
  background: var(--navy);
  color: rgba(255,255,255,.8);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 13px 16px;
  white-space: nowrap;
}

.lic-table tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
.lic-table tbody tr:last-child { border-bottom: none; }
.lic-table tbody tr:hover { background: rgba(10,38,71,.025); }
.lic-table tbody td { padding: 12px 16px; vertical-align: middle; }

.policy-num { font-family: var(--mono); font-size: 12px; color: var(--navy-mid); font-weight: 600; }
.client-name { font-weight: 600; color: var(--navy); }
.client-mobile { font-size: 12px; color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-navy {
  background: var(--navy);
  color: #fff; border: none;
  padding: 9px 20px;
  border-radius: 10px; font-weight: 600; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background .2s, transform .15s;
  text-decoration: none;
}
.btn-navy:hover { background: var(--navy-mid); color: #fff; transform: translateY(-1px); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy); border: none;
  padding: 9px 20px;
  border-radius: 10px; font-weight: 700; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: filter .2s, transform .15s;
  text-decoration: none;
}
.btn-gold:hover { filter: brightness(1.08); color: var(--navy); transform: translateY(-1px); }

.btn-outline-navy {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  padding: 7px 18px;
  border-radius: 10px; font-weight: 600; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all .2s; text-decoration: none;
}
.btn-outline-navy:hover { background: var(--navy); color: #fff; }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: 8px; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer; transition: all .2s;
  text-decoration: none;
}
.btn-icon.edit   { background: rgba(20,66,114,.1); color: var(--navy-mid); }
.btn-icon.delete { background: rgba(239,68,68,.1); color: var(--lapsed); }
.btn-icon.view   { background: rgba(16,185,129,.1); color: var(--active); }
.btn-icon:hover  { filter: brightness(1.15) saturate(1.2); transform: scale(1.08); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }

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

.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  background: #fafcff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(20,66,114,.1);
  outline: none; background: #fff;
}

.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  padding-bottom: 10px; margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
}

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.search-bar .form-control,
.search-bar .form-select { font-size: 13px; padding: 8px 12px; }

.search-bar .form-control { min-width: 220px; flex: 1; }

/* ── Reminder cards ────────────────────────────────────────── */
.reminder-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 10px;
  transition: box-shadow .2s;
}
.reminder-card:hover { box-shadow: var(--shadow-lg); }

.reminder-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.reminder-dot.urgent  { background: var(--lapsed); }
.reminder-dot.soon    { background: var(--gold); }
.reminder-dot.upcoming{ background: var(--active); }

.reminder-info { flex: 1; }
.reminder-client { font-size: 14px; font-weight: 600; color: var(--navy); }
.reminder-meta   { font-size: 12px; color: var(--text-muted); }
.reminder-due    { font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ── Alert custom ──────────────────────────────────────────── */
.alert { border-radius: 10px; font-size: 14px; border: none; }
.alert-icon { font-size: 16px; margin-right: 4px; }
.alert-success { background: rgba(16,185,129,.1); color: #065f46; }
.alert-danger  { background: rgba(239,68,68,.1);  color: #991b1b; }
.alert-warning { background: rgba(245,158,11,.1); color: #92400e; }
.alert-info    { background: rgba(20,66,114,.1);  color: var(--navy); }

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

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(251,197,49,.15) 0%, transparent 70%);
  top: -200px; right: -200px;
  border-radius: 50%;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(251,197,49,.08) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  border-radius: 50%;
}

.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  position: relative; z-index: 1;
}

.auth-logo {
  display: flex; align-items: center; gap: 12px;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-logo .brand-icon {
  width: 48px; height: 48px; font-size: 24px;
}

.auth-title  { font-size: 24px; font-weight: 800; color: var(--navy); text-align: center; margin-bottom: 4px; }
.auth-sub    { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.auth-footer { text-align: center; font-size: 13.5px; margin-top: 20px; color: var(--text-muted); }
.auth-footer a { color: var(--navy-mid); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 52px; margin-bottom: 16px; opacity: .35; }
.empty-state h5 { font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; }

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--navy); }
.page-header p  { font-size: 13.5px; color: var(--text-muted); margin: 0; }

/* ── Activity feed ─────────────────────────────────────────── */
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--navy-light); flex-shrink: 0; margin-top: 5px;
}

.activity-text { color: var(--text); flex: 1; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .content-area { padding: 20px 16px 40px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
  .stat-cards { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar { padding: 0 16px; }
}

/* ── Utilities ─────────────────────────────────────────────── */
.text-navy    { color: var(--navy) !important; }
.text-gold    { color: var(--gold) !important; }
.bg-navy      { background: var(--navy) !important; }
.rounded-12   { border-radius: 12px !important; }
.fw-800       { font-weight: 800 !important; }
.gap-chart    { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 767px) { .gap-chart { grid-template-columns: 1fr; } }
