/* ============================================================================
   EduQueue Theme v2  — brand facelift for the authenticated app shell.

   SAFE BY DESIGN:
   - Loaded AFTER background-override.css so it can win the cascade.
   - Every rule is scoped under `body.theme-v2`; with the flag off this file
     is inert (no selector matches), so the app renders exactly as before.
   - Pure skin: retargets EXISTING shell selectors only. No markup, JS,
     form-name, DataTables-init, or endpoint changes.
   - No !important escalation: the legacy overrides in main.css / customize.css /
     background-override.css are gated to `body:not(.theme-v2)`, so this file wins
     by honest specificity. The single remaining !important (.text-primary) only
     beats Bootstrap's own utility !important.

   Preview one page:  append ?theme=v2 to any app URL.
   Enable globally:   config APP_THEME_V2 = True  (or env APP_THEME_V2=true).
   Turn off:          remove the flag — instant, total revert.
   ========================================================================== */

body.theme-v2 {
  --eq-ink:#0b1220;          /* headings */
  --eq-text:#334155;         /* body text */
  --eq-muted:#64748b;        /* secondary text */
  --eq-surface:#ffffff;      /* cards / panels */
  --eq-line:#e7ebf3;         /* hairline borders */
  --eq-blue:#3b82f6;
  --eq-blue-dp:#1d4ed8;
  --eq-emerald:#10b981;
  --eq-sidebar-1:#0a1428;    /* deep cobalt-navy sidebar gradient */
  --eq-sidebar-2:#0f2149;
  --eq-radius:16px;
  --eq-shadow:0 1px 2px rgba(15,23,42,.05), 0 12px 28px -16px rgba(15,23,42,.30);
  --eq-shadow-hover:0 2px 4px rgba(15,23,42,.06), 0 22px 44px -18px rgba(29,78,216,.32);
  --eq-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}

/* ---- Bespoke per-page brand tokens -------------------------------------- *
   Several bespoke screens (dashboard family, some forms) declare their OWN
   `:root` brand tokens in old indigo/violet. Redefining those token *names*
   here on body.theme-v2 cascades cobalt/emerald down to every such page at
   once — no per-file edits, and inert on pages that don't use the names.
   Only re-points colour tokens; shadows/spacing tokens are left untouched. */
body.theme-v2 {
  --primary-color:#2563eb; --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --secondary-color:#3b82f6; --secondary:#3b82f6;
  --gradient-primary:linear-gradient(135deg,#3b82f6 0%,#1d4ed8 100%);
}

/* ---- App canvas: off-white with a faint cobalt aura up top --------------- */
body.theme-v2,
body.theme-v2.fixed-nav,
body.theme-v2.sticky-footer,
body.theme-v2[style] {
  background:
    radial-gradient(1200px 520px at 78% -8%, rgba(59,130,246,.10), transparent 60%),
    linear-gradient(180deg, #eef2f8 0%, #e6ebf4 100%);
  background-attachment: fixed;
  font-family: var(--eq-font);
  color: var(--eq-text);
}
body.theme-v2 .main-content { background: transparent; }
body.theme-v2 .main-content .container-fluid { padding: 2rem 2.25rem; }

/* ---- Sidebar: rich navy, rounded active pill with glow ------------------- */
body.theme-v2 .sidebar {
  background: linear-gradient(185deg, var(--eq-sidebar-1) 0%, var(--eq-sidebar-2) 100%);
  border-right: 1px solid rgba(255,255,255,.05);
  box-shadow: 1px 0 0 rgba(0,0,0,.2), inset -1px 0 0 rgba(255,255,255,.03);
}
body.theme-v2 .sidebar-logo { padding: 1.1rem .9rem; border-bottom: 1px solid rgba(255,255,255,.06); }
body.theme-v2 .sidebar-building-selector,
body.theme-v2 .sidebar-profile { border-bottom-color: rgba(255,255,255,.06); }

body.theme-v2 .sidebar-nav .nav-item .nav-link {
  color: rgba(255,255,255,.66);
  border-radius: 10px;
  margin: 2px 10px;
  padding: .62rem .7rem;
  font-weight: 500;
  border-left: 0;
}
body.theme-v2 .sidebar-nav .nav-item .nav-link:hover {
  color:#fff; background: rgba(255,255,255,.06); padding-left:.7rem;
}
body.theme-v2 .sidebar-nav .nav-item .nav-link.active {
  color:#fff;
  background: linear-gradient(100deg, rgba(59,130,246,.85), rgba(37,99,235,.65));
  border-left: 0;
  box-shadow: 0 8px 20px -8px rgba(37,99,235,.7), inset 0 1px 0 rgba(255,255,255,.18);
}
body.theme-v2 .sidebar-nav .nav-item .nav-link i { color: rgba(255,255,255,.42); }
body.theme-v2 .sidebar-nav .nav-item .nav-link:hover i { color:#fff; }
body.theme-v2 .sidebar-nav .nav-item .nav-link.active i { color:#fff; }
body.theme-v2 .sidebar-nav hr { border-color: rgba(255,255,255,.07); }

body.theme-v2 .building-selector-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
}
body.theme-v2 .building-selector-btn:hover { background: rgba(59,130,246,.16); border-color: rgba(59,130,246,.45); }
body.theme-v2 .building-selector-btn i:first-child { color: var(--eq-emerald); }

/* ---- Page header --------------------------------------------------------- */
body.theme-v2 .page-header h1,
body.theme-v2 .page-header h2 { color: var(--eq-ink); font-weight: 700; letter-spacing:-.01em; }
body.theme-v2 .page-header p  { color: var(--eq-muted); }

/* ---- Cards / content surfaces: elevated with hover lift ------------------ */
body.theme-v2 .content-section,
body.theme-v2 .card {
  background-color: var(--eq-surface);
  border: 1px solid var(--eq-line);
  border-radius: var(--eq-radius);
  box-shadow: var(--eq-shadow);
  transition: box-shadow .22s ease, transform .22s ease;
}
body.theme-v2 .card:hover { box-shadow: var(--eq-shadow-hover); transform: translateY(-2px); }
body.theme-v2 .card-header {
  background:#fff;
  border-bottom: 1px solid var(--eq-line);
  font-weight: 700;
  color: var(--eq-ink);
  border-top-left-radius: var(--eq-radius);
  border-top-right-radius: var(--eq-radius);
}

/* ---- Buttons: gradient primary, lift on hover ---------------------------- */
body.theme-v2 .btn { border-radius: 11px; font-weight: 600; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
body.theme-v2 .btn-primary {
  background: linear-gradient(135deg, var(--eq-blue), var(--eq-blue-dp));
  border-color: var(--eq-blue-dp);
  box-shadow: 0 10px 22px -12px rgba(37,99,235,.85);
}
body.theme-v2 .btn-primary:hover,
body.theme-v2 .btn-primary:focus { transform: translateY(-1px); box-shadow: 0 16px 30px -12px rgba(29,78,216,.9); background: linear-gradient(135deg,#2f74ee,#1a45c8); }
body.theme-v2 .btn-outline-primary { color: var(--eq-blue-dp); border-color: var(--eq-blue); }
body.theme-v2 .btn-outline-primary:hover { background: var(--eq-blue); border-color: var(--eq-blue); color:#fff; transform: translateY(-1px); }
body.theme-v2 .btn-success { background: linear-gradient(135deg,#12b981,#0e9f6e); border-color:#0e9f6e; }
body.theme-v2 .btn-secondary { background:#eef1f7; border-color:#e1e6f0; color:#334155; }

/* ---- Links & accents ----------------------------------------------------- */
body.theme-v2 a { color: var(--eq-blue-dp); }
body.theme-v2 a:hover { color: var(--eq-blue); }
body.theme-v2 .text-primary { color: var(--eq-blue-dp) !important; }

/* ---- Tables: airy, tinted header, row hover ------------------------------ */
body.theme-v2 .table { background-color: var(--eq-surface); }
body.theme-v2 .table thead th {
  background: #f4f7fc;
  color: var(--eq-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--eq-line);
  border-top: none;
  padding-top: .8rem; padding-bottom: .8rem;
}
body.theme-v2 .table td { border-top-color: var(--eq-line); vertical-align: middle; padding-top: .72rem; padding-bottom: .72rem; }
body.theme-v2 .table-hover tbody tr:hover { background-color: rgba(59,130,246,.055); }

/* ---- Badges → pills ------------------------------------------------------ */
body.theme-v2 .badge {
  border-radius: 999px;
  padding: .38em .75em;
  font-weight: 600;
  letter-spacing: .01em;
}
body.theme-v2 .badge-primary { background: var(--eq-blue-dp); }
body.theme-v2 .badge-success { background: var(--eq-emerald); }
body.theme-v2 .badge-info    { background: var(--eq-blue); }

/* ---- Forms --------------------------------------------------------------- */
body.theme-v2 .form-control,
body.theme-v2 .custom-select { border-radius: 11px; border-color: #d5dbe6; }
body.theme-v2 .form-control:focus,
body.theme-v2 .custom-select:focus { border-color: var(--eq-blue); box-shadow: 0 0 0 3px rgba(59,130,246,.16); }

/* ---- Top navbar ---------------------------------------------------------- */
body.theme-v2 .navbar {
  background-color: rgba(255,255,255,.85);
  backdrop-filter: saturate(150%) blur(8px);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--eq-line);
  box-shadow: 0 1px 0 rgba(15,23,42,.04);
}

/* ---- Building-selector modal + profile badge (live in the eduqueue.html
   shell's own inline <style>; theme-v2.css loads after it, so we win). ----- */
body.theme-v2 .nav-profile-image::after { background: #2563eb; }
body.theme-v2 .building-icon-bg,
body.theme-v2 .building-card input[type="radio"]:checked + .building-card-content,
body.theme-v2 .btn-building-submit { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
body.theme-v2 .building-icon-particles span { background: #3b82f6; }
body.theme-v2 .building-card-icon i,
body.theme-v2 .current-location-note i { color: #2563eb; }

/* ---- Page-specific inline-style overrides -------------------------------- *
   A few buttons carry an inline gradient; re-point them under the flag with a
   targeted !important (only way to beat an inline style). IDs are page-unique. */
body.theme-v2 #eq-fast-scan-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%) !important;
}
/* Check-in "Scan" control: an id/inline path keeps it indigo; win by id. */
body.theme-v2 #scan-id-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
  color: #fff !important;
}

/* Modals intentionally left to background-override.css (solid white) —
   the theme must not touch the visitor-detail-modal opacity fixes. */
