/* ============================================================
   Babane VC Attorneys LMS — Brand Stylesheet
   Brand: Maroon #7B1E3C | Gold #C4A44A | White #FFFFFF
   ============================================================ */

/* Bootstrap 5 brand-color bridge — must come before our custom vars */
:root {
  --bs-primary:          #7B1E3C;
  --bs-primary-rgb:      123, 30, 60;
  --bs-secondary:        #C4A44A;
  --bs-secondary-rgb:    196, 164, 74;
  --bs-success:          #059669;
  --bs-success-rgb:      5, 150, 105;
  --bs-danger:           #DC2626;
  --bs-danger-rgb:       220, 38, 38;
  --bs-warning:          #D97706;
  --bs-warning-rgb:      217, 119, 6;
  --bs-info:             #2563EB;
  --bs-info-rgb:         37, 99, 235;
  --bs-body-font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --bs-body-font-size:   0.875rem;
  --bs-body-color:       #2D2D2D;
  --bs-body-bg:          #F8F5F0;
  --bs-link-color:       #7B1E3C;
  --bs-link-hover-color: #5A1530;
  --bs-border-color:     #E2D9D0;
  --bs-border-radius:    0.4375rem;
  --bs-focus-ring-color: rgba(123, 30, 60, 0.25);
}

:root {
  --primary:      #7B1E3C;
  --primary-dark: #5A1530;
  --primary-light:#A0285A;
  --gold:         #C4A44A;
  --gold-dark:    #A8882E;
  --gold-light:   #D4B870;
  --white:        #FFFFFF;
  --light:        #F8F5F0;
  --light2:       #F0EBE4;
  --border:       #E2D9D0;
  --dark:         #1A1A1A;
  --text:         #2D2D2D;
  --muted:        #6B7280;
  --success:      #059669;
  --warning:      #D97706;
  --danger:       #DC2626;
  --info:         #2563EB;
  --sidebar-w:    260px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--light);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--light); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(196,164,74,.2);
}
.sidebar-logo .firm-name {
  font-size: .9rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.2;
  display: block;
}
.sidebar-logo .tagline {
  font-size: .68rem;
  color: rgba(255,255,255,.6);
  display: block;
  margin-top: 3px;
  font-style: italic;
}
.sidebar-logo .role-badge {
  display: inline-block;
  margin-top: 8px;
  background: rgba(196,164,74,.15);
  border: 1px solid rgba(196,164,74,.3);
  color: var(--gold);
  font-size: .65rem;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.sidebar nav { padding: 12px 0; flex: 1; }
.nav-section {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  padding: 16px 20px 4px;
  font-weight: 700;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .85rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar a:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
  border-left-color: rgba(196,164,74,.4);
}
.sidebar a.active {
  background: rgba(196,164,74,.15);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 600;
}
.sidebar a .icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar a .badge-count {
  margin-left: auto;
  background: var(--gold);
  color: var(--primary-dark);
  font-size: .65rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .78rem;
  color: rgba(255,255,255,.5);
}
.sidebar-footer a { color: rgba(255,255,255,.6); font-size: .8rem; }

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

/* ── TOP BAR ── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.notif-bell {
  position: relative;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--muted);
  transition: background .15s;
}
.notif-bell:hover { background: var(--light); }
.notif-bell .count {
  position: absolute;
  top: 0; right: 0;
  background: var(--danger);
  color: white;
  font-size: .6rem;
  font-weight: 800;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.user-menu:hover { background: var(--light); border-color: var(--border); }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .78rem;
}
.user-menu-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  gap: 8px;
  width: 260px;
}
.search-bar input {
  border: none;
  background: none;
  outline: none;
  font-size: .83rem;
  width: 100%;
  color: var(--text);
}
.search-bar .icon { color: var(--muted); font-size: .9rem; }

/* ── PAGE BODY ── */
.page-body { padding: 28px; flex: 1; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.page-header p { color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* ── STAT CARDS (legacy) ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-card .sv { font-size: 1.8rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card .sl { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.stat-card .sc { font-size: .75rem; margin-top: 6px; }
.stat-card .sc.up { color: var(--success); }
.stat-card .sc.dn { color: var(--danger); }
.stat-card .sc.warn { color: var(--warning); }
.stat-card.gold-border { border-left: 4px solid var(--gold); }
.stat-card.maroon-border { border-left: 4px solid var(--primary); }
.stat-card.green-border { border-left: 4px solid var(--success); }
.stat-card.red-border { border-left: 4px solid var(--danger); }

/* ── STAT PLATES (dashboard metric tiles) ── */
.stat-plate {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: box-shadow .15s, transform .15s;
}
.stat-plate:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.sp-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sp-body { min-width: 0; }
.sp-value { font-size: 1.55rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.sp-label { font-size: .73rem; font-weight: 600; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-change { font-size: .72rem; margin-top: 3px; color: var(--muted); }
.sp-change.up   { color: var(--success); }
.sp-change.dn   { color: var(--danger); }
.sp-change.warn { color: var(--warning); }
.stat-plate.maroon-border .sp-icon { background: rgba(123,30,60,.09);  color: var(--primary); }
.stat-plate.gold-border   .sp-icon { background: rgba(196,164,74,.13); color: #9a7f2a; }
.stat-plate.green-border  .sp-icon { background: rgba(16,185,129,.1);  color: var(--success); }
.stat-plate.red-border    .sp-icon { background: rgba(220,38,38,.09);  color: var(--danger); }

/* ── CARDS ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: var(--gold); }
.btn-primary:hover { background: var(--primary-dark); color: var(--gold-light); }
.btn-gold { background: var(--gold); color: var(--primary-dark); }
.btn-gold:hover { background: var(--gold-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .92rem; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .85rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123,30,60,.1);
}
.form-control:disabled { background: var(--light); color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--light);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .84rem;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--light); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-active   { background: #FEF3C7; color: #92400E; }
.badge-success  { background: #D1FAE5; color: #065F46; }
.badge-danger   { background: #FEE2E2; color: #991B1B; }
.badge-warning  { background: #FEF3C7; color: #92400E; }
.badge-info     { background: #DBEAFE; color: #1E40AF; }
.badge-muted    { background: #F3F4F6; color: #4B5563; }
.badge-gold     { background: #FEF3C7; color: #7B4F00; }
.badge-primary  { background: #FCE7EF; color: #7B1E3C; }

/* ── ALERTS / FLASH ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .85rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-overlay .modal {
  position: static;
  display: block;
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  height: auto;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: visible;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  transform: translateY(20px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── STAGE PIPELINE ── */
.stage-pipeline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.stage-step {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--light);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.stage-step.done { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; }
.stage-step.active { background: var(--primary); color: var(--gold); border-color: var(--primary); font-weight: 700; }
.stage-arrow { color: var(--border); font-size: .8rem; }

/* ── PROGRESS BAR ── */
.progress-wrap { background: var(--light2); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--gold)); }

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--white);
}
.timeline-item.public::before  { background: var(--primary); }
.timeline-item.system::before  { background: var(--muted); }
.timeline-item .tl-meta { font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.timeline-item .tl-body {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .84rem;
}
.timeline-item.public .tl-body { border-left: 3px solid var(--primary); }
.timeline-item.confidential .tl-body { border-left: 3px solid var(--danger); background: #FFF5F5; }

/* ── DROPDOWN MENU ── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: .83rem;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--light); }
.dropdown-menu .divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ── NOTIFICATION DROPDOWN ── */
.notif-dropdown {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 340px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 300;
  display: none;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-item {
  display: flex; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--light); }
.notif-item.unread { background: #FDF8F0; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-dot.unread { background: var(--gold); }
.notif-dot.read   { background: var(--border); }
.notif-item .nt { font-size: .82rem; font-weight: 600; color: var(--text); }
.notif-item .nm { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.notif-item .ntm { font-size: .7rem; color: var(--muted); margin-top: 4px; }

/* ── MOBILE ── */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: block; }
  .search-bar { display: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .firm { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.login-logo .tag  { font-size: .75rem; color: var(--gold-dark); font-style: italic; margin-top: 3px; }
.login-card h2 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 20px; text-align: center; }

/* ── MISC ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .78rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.empty-state p { font-size: .88rem; }
