/* TRACKIT UI System - Law-enforcement grade styling */
:root {
  --bg-body: #f6f7f9;
  --text-strong: #0f172a;
  --text-muted: #6b7280;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --card-radius: 12px;
  --shadow: 0 6px 20px rgba(2, 6, 23, 0.06);

  --accent-primary: #2563eb;
  --accent-dark: #334155;
  --accent-success: #16a34a;
  --accent-warning: #f59e0b;
  --accent-danger:  #dc2626;
  --accent-secondary: #64748b;
  --accent-info: #0ea5e9;

  --sidebar-bg: #0f172a;
  --sidebar-text: #e5e7eb;
  --sidebar-muted: #94a3b8;
}

/* Base layout */
body.app-body { background: var(--bg-body); color: #222; padding-top: 0; }
.app-shell { min-height: calc(100vh - 52px); }
.app-footer { background: transparent; }

/* Sidebar */
.app-sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); border-radius: 12px; box-shadow: var(--shadow); }
.app-sidebar .sidebar-section { margin: 0; }
.app-sidebar .sidebar-section-title { color: var(--sidebar-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.sidebar-link { display: flex; align-items: center; gap: .5rem; color: var(--sidebar-text); text-decoration: none; padding: .4rem .2rem; border-radius: 8px; }
.sidebar-link:hover { background: rgba(255,255,255,.06); color: #fff; }

/* Alerts */
.app-alerts .alert { border-radius: 0; }

/* Location overlay */
.location-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.75); display: flex; align-items: center; justify-content: center; z-index: 1050; }
.location-overlay .location-overlay-content { max-width: 560px; width: calc(100% - 2rem); box-shadow: var(--shadow); }
body.location-blocked .app-shell { filter: blur(1px); }
body.location-blocked .navbar, body.location-blocked .app-footer { opacity: 1; }


/* Cards and stats */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--card-radius); box-shadow: var(--shadow); }
.card .small { color: var(--text-muted); font-weight: 600; letter-spacing: .02em; }
.card .h4 { color: var(--text-strong); font-weight: 700; }
.card.text-bg-primary, .card.text-bg-dark, .card.text-bg-success, .card.text-bg-warning, .card.text-bg-danger, .card.text-bg-secondary, .card.text-bg-info { background: var(--card-bg) !important; }
 .card.text-bg-primary { border-left: 6px solid var(--accent-primary); }
 .card.text-bg-dark    { border-left: 6px solid var(--accent-dark); }
 .card.text-bg-success { border-left: 6px solid var(--accent-success); }
 .card.text-bg-warning { border-left: 6px solid var(--accent-warning); }
 .card.text-bg-danger  { border-left: 6px solid var(--accent-danger); }
 .card.text-bg-secondary{ border-left: 6px solid var(--accent-secondary); }
 .card.text-bg-info    { border-left: 6px solid var(--accent-info); }


/* Tables */
.table thead th { color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--card-border); }
.table tbody td { padding-top: .6rem; padding-bottom: .6rem; }

/* Status badges */
.status-badge { font-weight: 700; letter-spacing: .02em; }
.badge-status-clean { background: #e6fffa; color: #0f766e; border: 1px solid #99f6e4; }
.badge-status-used  { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.badge-status-stolen{ background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Map */
.map-container { width: 100%; min-height: 280px; background: #e2e8f0; border: 1px solid var(--card-border); border-radius: 10px; }
.map-legend .legend-item { display: inline-flex; align-items: center; gap: .35rem; background: #f8fafc; color: #334155; border: 1px solid var(--card-border); border-radius: 20px; padding: .25rem .6rem; margin-right: .5rem; }
.map-legend .legend-clean { border-color: #99f6e4; color: #0f766e; }
.map-legend .legend-used  { border-color: #fed7aa; color: #9a3412; }
.map-legend .legend-stolen{ border-color: #fecaca; color: #991b1b; }

/* Auth dashboard scope */
.auth-dashboard .row.g-3 > [class^="col"] .card { min-height: 96px; display: flex; align-items: center; }
.auth-dashboard .card-header { background: #f8fafc; border-bottom: 1px solid var(--card-border); font-weight: 600; }

/* Print styles for certificates */
@media print {
  body { background: #fff; }
  .navbar, .app-sidebar, .app-alerts, .app-footer { display: none !important; }
  .certificate { page-break-inside: avoid; }
  .certificate .card { border: 2px solid #000 !important; box-shadow: none !important; }
}

/* Sidebar collapsible sections */
.app-sidebar .sidebar-section { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 0.5rem; }
.app-sidebar .sidebar-section:first-of-type { border-top: 0; }
.app-sidebar .sidebar-toggle { text-decoration: none; padding-left: 0; }
.app-sidebar .sidebar-toggle .bi { transition: transform 0.2s ease; }

/* Dark themed list group items */
.app-sidebar .list-group-item { background: transparent; color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.15); display: flex; align-items: center; gap: .5rem; padding: .4rem .25rem; }
.app-sidebar .list-group-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.app-sidebar .list-group-item.active { background: rgba(37,99,235,0.2); color: #fff; border-color: rgba(37,99,235,0.35); }
.app-sidebar .list-group-item i { width: 1.25rem; text-align: center; }

/* Rotate chevron when collapsed */
.app-sidebar .sidebar-toggle[aria-expanded="false"] .bi { transform: rotate(-90deg); }

/* Ensure icons align consistently */
.app-sidebar .sidebar-link i { width: 1.25rem; text-align: center; }