/* theme.css */
/* ================================
   Global Reset & Variables
================================= */
:root {
  --primary-color: #0066cc;
  --sidebar-width: 250px;
  --topbar-height: 70px;

  /* shared UI vars */
  --border: #d0d7de;
  --text: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
}

body {
  background-color: #f5f5f7;
}

/* Layout container (used by navbar and pages) */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ================================
   Login Page
================================= */
body.login-page {
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  position: relative; /* needed for back-button positioning */
}

.login-container {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 350px;
  text-align: center;
}

.logo {
  width: 100px;
  height: 100px;
  margin: 0 auto 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  font-weight: bold;
}

/* Back button on login page */
.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
}

.back-button a {
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s;
}

.back-button a:hover {
  color: #004499;
}

/* ================================
   Form Inputs
================================= */
h1, h3 {
  color: #333;
  margin-bottom: 20px;
  font-size: 18px;
}

.input-group {
  margin-bottom: 20px;
  position: relative;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: bold;
  text-align: left;
}

input {
  width: 100%;
  padding: 10px 10px 10px 40px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 16px;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 38px;
  color: #777;
}

.forgot-password {
  text-align: right;
  margin-bottom: 25px;
}

.forgot-password a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
}

.login-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.login-button:hover {
  background-color: #0055aa;
}

.error-message {
  color: red;
  margin-bottom: 15px;
  display: none;
}

/* ================================
   Dashboard Layout
================================= */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: #2c3e50;
  color: white;
  height: 100vh;
  position: fixed;
  padding-top: 20px;
}

.logo2 {
  text-align: center;
  padding: 5px 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.logo h2 {
  color: white;
  font-size: 15px;
}

.nav-menu {
  list-style: none;
}

.nav-item {
  padding: 15px 25px;
  transition: all 0.3s;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.nav-item.active {
  background-color: var(--primary-color);
}

.nav-item i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background-color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: #f5f5f7;
  border-radius: 20px;
  padding: 8px 15px;
  width: 300px;
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  padding: 5px 10px;
}

.search-bar i {
  color: #777;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}

/* ================================
   Cards & Content
================================= */
.content {
  padding: 30px;
}

.card-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.card {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.card h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

.welcome-banner {
  background-color: white;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.welcome-banner h2 {
  color: #333;
  margin-bottom: 10px;
}

.welcome-banner p {
  color: #777;
}

/* ================================
   Logout
================================= */
.logout-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  margin-left: 10px;
}

.logout-btn:hover {
  color: #004499;
}

/* ================================
   Map & Chart Grid Layout (Dashboard)
================================= */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr); /* ensures equal width + shrink */
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
}
.grid-2 > * { min-width: 0; } /* prevent content from forcing shrink */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
}
.grid-3 > * { min-width: 0; }

/* Cards host flex children so their content (map/canvas) fills height */
.map-card, .chart-card {
  display: flex;
  flex-direction: column;
}

/* Explicit heights prevent infinite growth */
.map-card #map {
  width: 100%;
  height: 420px;      /* fixed height for map */
  border-radius: 8px;
  background: #f5f5f7;
}

.chart-card canvas {
  width: 100% !important;
  height: 420px !important; /* match map height */
  border-radius: 8px;
  background: #f5f5f7;
}

/* Responsive: stack on smaller screens */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* ================================
   Unified Button Styles (buttons & links)
   Use: class="btn primary|success|danger"
================================= */
button.btn,
a.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #182447, #0f1833);
  color: var(--text);
  cursor: pointer;
  transition: transform .04s ease, box-shadow .2s ease, opacity .2s ease;
  text-decoration: none;     /* make anchors look like buttons */
  display: inline-block;     /* ensure padding works on <a> */
  line-height: 1;            /* tidy baseline */
  user-select: none;
}

button.btn:hover,
a.btn:hover {
  box-shadow: 0 6px 18px rgba(91, 188, 255, .15);
}

button.btn:active,
a.btn:active {
  transform: translateY(1px);
}

/* Focus ring */
button.btn:focus-visible,
a.btn:focus-visible {
  outline: 2px solid rgba(29, 78, 216, .6);
  outline-offset: 2px;
}

/* Variants */
button.primary, a.primary {
  background: linear-gradient(180deg, #1d4ed8, #1b3ea3);
  border-color: #1d3f8f;
  color: #fff;
}

button.success, a.success {
  background: linear-gradient(180deg, #2ea043, #19732b);
  border-color: #1d7c33;
  color: #fff;
}

button.danger, a.danger {
  background: linear-gradient(180deg, #b91c1c, #7f1d1d);
  border-color: #7f1d1d;
  color: #fff;
}

/* Extra Button Variants */
button.info, a.info {
  background: linear-gradient(180deg, #06b6d4, #0e7490);
  border-color: #0e7490;
  color: #fff;
}
button.warning, a.warning {
  background: linear-gradient(180deg, #f59e0b, #b45309);
  border-color: #b45309;
  color: #fff;
}
button.secondary, a.secondary {
  background: linear-gradient(180deg, #6b7280, #374151);
  border-color: #374151;
  color: #fff;
}
button.purple, a.purple {
  background: linear-gradient(180deg, #8b5cf6, #5b21b6);
  border-color: #5b21b6;
  color: #fff;
}

/* Disabled states */
button.btn[disabled],
a.btn[aria-disabled="true"] {
  opacity: .6;
  pointer-events: none;
  cursor: not-allowed;
}

/* ================================
   Alerts / Messages
================================= */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.alert.error {
  background-color: #fee2e2;   /* light red */
  border: 1px solid #b91c1c;  /* dark red */
  color: #7f1d1d;
}
.alert.success {
  background-color: #dcfce7;   /* light green */
  border: 1px solid #15803d;  /* dark green */
  color: #166534;
}

/* ================================
   Tables (Owners, Case Groups, etc.)
================================= */
.table-card { padding: 0; overflow: hidden; }

.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #eef1f4; background: #fff;
}
.table-title {
  font-weight: 700; color: #111827; letter-spacing: .2px;
}
.table-tools .muted { color: #6b7280; font-size: 14px; }

.table-wrap { overflow: auto; }
.table-wrap table.dla-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: #fff;
}
/* Force table headers left-aligned */
.table-wrap table.dla-table th { text-align: left; }

.table-wrap table.dla-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #fff; color: #374151;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em;
  padding: 14px 16px; border-bottom: 1px solid #e5e7eb;
}
.table-wrap table.dla-table th:first-child,
.table-wrap table.dla-table td:first-child { padding-left: 20px; }
.table-wrap table.dla-table th:last-child,
.table-wrap table.dla-table td:last-child { padding-right: 20px; }

.table-wrap table.dla-table tbody td {
  padding: 14px 16px; border-bottom: 1px solid #f1f5f9;
  color: #1f2937; vertical-align: middle;
}
.table-wrap table.dla-table tbody tr:nth-child(even) { background: #fafbff; }

/* Animate rows on hover-in and hover-out */
.table-wrap table.dla-table tbody tr {
  transition: background 0.15s ease, box-shadow 0.15s ease;
  will-change: background, box-shadow;
}
.table-wrap table.dla-table tbody tr:hover {
  background: #f3f8ff;
  box-shadow: inset 3px 0 0 var(--primary-color);
}

/* Small button variant for Actions */
.btn.sm { padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1; }

/* Empty state */
.empty-state {
  display: flex; align-items: center; gap: 12px;
  padding: 22px; border-top: 1px dashed #e5e7eb; background: #fff;
}
.empty-emoji { font-size: 24px; }
.empty-text p { color: #6b7280; margin-top: 2px; font-size: 14px; }

/* Utility */
.is-hidden { display: none !important; }
.muted { color: #6b7280; }

/* Sorting indicators */
.table-wrap table.dla-table th.sorted-asc::after {
  content: " ▲";
  font-size: 10px;
  color: var(--primary-color);
}
.table-wrap table.dla-table th.sorted-desc::after {
  content: " ▼";
  font-size: 10px;
  color: var(--primary-color);
}
.table-wrap table.dla-table th[data-sortable="true"] { cursor: pointer; }
.table-wrap table.dla-table th[data-sortable="true"]:hover { background: #f8fafc; }

/* ================================
   Shared Navbar (Case Groups + children)
================================= */


/* header.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.86));
  border-bottom: 1px solid #eef1f4;
} */


/* OPTION B */
/* NAV: Midnight Glass */
header.nav {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(90deg, rgba(0, 28, 99, 0.92), rgba(0, 99, 0, 0.95));
  border-bottom: 1px solid rgba(96,165,250,.25);
  backdrop-filter: saturate(130%) blur(8px);
  box-shadow: 0 6px 24px rgba(2,6,23,.25);
}




/* Only lighten on dark navs */
header.nav.nav--dark .brand-text {
  color: #e6f0ff;              /* soft white/blue for dark bg */
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}


.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(180deg, #7a8dc5, #32b4a9);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .08em;
}
.brand-text {
  color: #3a8ba0;
  font-weight: 800;
  letter-spacing: .02em;
}

.nav-main { display: flex; gap: 16px; }
.nav-main a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #1f2937;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav-main a:hover { background: #f3f4f6; }

/* .nav-main a.is-active {
  background: #e8f0ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #c7dbff;
} */


/* OPTION B */
/* Active main link: cyan accent */ 
.nav-main a.is-active {
  background: rgba(56,189,248,.16);
  color: #38bdf8;                   /* cyan-400 */
  box-shadow: inset 0 0 0 1px rgba(56,189,248,.45),
              0 6px 18px rgba(56,189,248,.18);
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
 }


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

/* Breadcrumb + tabs */
.subnav {
  border-top: 1px solid #f3f4f6;
  border-bottom: 1px solid #eef1f4;
  background: #fff;
}
.subnav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 12px;
}
.crumb { color: #6b7280; font-size: 14px; }
.crumb-home { color: #6b7280; text-decoration: none; }
.crumb-home:hover { text-decoration: underline; }
.crumb-sep { margin: 0 6px; color: #9ca3af; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a {
  display: inline-flex; align-items: center;
  padding: 10px 12px; border-radius: 999px;
  text-decoration: none; color: #374151; font-weight: 600;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tabs a:hover { background: #f3f4f6; }
.tabs a.is-active {
  background: #1d4ed8; color: #fff;
  box-shadow: 0 6px 18px rgba(29,78,216,.18);
}

/* Responsive navbar tweaks */
@media (max-width: 640px) {
  .brand-text { display: none; }
  .nav-wrap { height: 58px; }
  .subnav-wrap { flex-direction: column; align-items: stretch; padding: 8px 0; }
  .tabs { justify-content: space-between; }
}


/* Align selection marker (checkbox/radio) and label text on the same axis */
.leaflet-control-layers label,
.leaflet-control-layers label > div {
  display: grid;
  grid-template-columns: 18px 1fr; /* selector | text */
  align-items: center;             /* 🔧 vertical-center both */
  gap: 8px;
  line-height: 1.25;
}

/* Normalize the selector box size & remove odd offsets across browsers */
.leaflet-control-layers-selector {
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;  /* extra safety */
  transform: translateY(0); /* neutralize any UA default nudges */
}

/* Keep row hit-area comfy without shifting alignment */
.leaflet-control-layers label {
  padding: 6px 4px;
  border-radius: 8px;
}
.leaflet-control-layers label:hover { background: #f9fafb; }

/* If a label wraps to 2+ lines, keep the first line aligned with the marker */
.leaflet-control-layers label span { line-height: 1.25; }

/* (Optional) If you use bigger fonts, scale the selector to match */
@supports (-webkit-appearance:none) or (appearance:none) {
  /* Safari sometimes needs a tiny nudge; comment out if unnecessary */
  .leaflet-control-layers-selector[type="radio"],
  .leaflet-control-layers-selector[type="checkbox"] {
    position: relative;
    top: 0; /* set to -0.5px if you still see a 1px drift on Safari */
  }
}


/* Payments summary block under "Payments Report" */
.payments-summary-wrapper {
  max-width: 520px;
  margin: 4px 0 14px;
  padding: 8px 10px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.015);
}

.payments-summary-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted-color);
  margin-bottom: 6px;
}

/* Make the mini table compact and card-like, without affecting other tables */
.table.payments-summary-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #fff;
  font-size: 0.9rem;
}

.table.payments-summary-table thead {
  background: rgba(0, 0, 0, 0.03);
}

.table.payments-summary-table th,
.table.payments-summary-table td {
  padding: 6px 10px;
}

.table.payments-summary-table th {
  font-weight: 600;
  color: var(--muted-color);
  text-align: left;
  font-size: 0.8rem;
}

/* Right-align numeric columns */
.table.payments-summary-table th:nth-child(2),
.table.payments-summary-table th:nth-child(3),
.table.payments-summary-table td:nth-child(2),
.table.payments-summary-table td:nth-child(3) {
  text-align: right;
}

/* Light zebra striping */
.table.payments-summary-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

/* Emphasise "All payments" row slightly */
.table.payments-summary-table tbody tr:first-child td {
  font-weight: 600;
}
