/* =========================================================================
   PurpleCare Clinician Portal — Dark Theme Override
   Wolfgang, 27 May 2026
   Palette matched to /worker-app (worker portal):
     --bg:        #1a0a2e   page background (deep dark purple)
     --card:      #0d0d1a   card / panel background (deep navy)
     --card-2:    #14112b   raised surfaces / alt rows
     --purple:    #7c3aed   primary action / accent
     --purple-2:  #6d28d9   primary hover
     --purple-3:  #a78bfa   secondary accent text
     --text:      #f5f3ff   body text
     --muted:     #a78bfa   muted / labels
     --line:      #3b2566   borders
   This file loads LAST in base.html and aggressively overrides the legacy
   light palette with !important to defeat inline styles in page templates.
   ========================================================================= */

:root{
  --pc-bg:#1a0a2e;
  --pc-card:#0d0d1a;
  --pc-card-2:#14112b;
  --pc-purple:#7c3aed;
  --pc-purple-2:#6d28d9;
  --pc-purple-3:#a78bfa;
  --pc-text:#f5f3ff;
  --pc-muted:#a78bfa;
  --pc-line:#3b2566;
  --pc-ok:#10b981;
  --pc-warn:#f59e0b;
  --pc-err:#ef4444;
}

/* ---------- Page surface ---------- */
html,body{
  background:var(--pc-bg) !important;
  color:var(--pc-text) !important;
}
body, .main, .wrap{ background:transparent !important; }

a{ color:var(--pc-purple-3) !important; }
a:hover{ color:#c4b5fd !important; }

h1,h2,h3,h4,h5,h6{ color:var(--pc-text) !important; }
p, span, li, td, th, label, small, em, strong, div{ color:inherit; }

/* ---------- Nav ---------- */
.nav{
  background:linear-gradient(180deg,#1a0a2e 0%,#150826 100%) !important;
  border-bottom:1px solid var(--pc-line) !important;
}
.brand{ color:#fff !important; }
.brand .sub{ color:var(--pc-purple-3) !important; }
.brand .poweredby{ color:#c4b5fd !important; }
.brand .poweredby strong{ color:#fff !important; }
.nav-links a{ color:#e9d5ff !important; }
.nav-links a:hover{ color:#fff !important; }
.nav-links a.active{ color:#fff !important; border-bottom-color:var(--pc-purple) !important; }
.nav-row{ border-bottom-color:var(--pc-line) !important; }
.nav-toggle span{ background:#e9d5ff !important; }
.user-chip, .user-chip .who-line{ color:#e9d5ff !important; }
.user-chip .who{ color:#fff !important; }
.role-pill{ background:rgba(124,58,237,.25) !important; color:#e9d5ff !important; }

/* ---------- Page head ---------- */
.page-head h1{ color:#fff !important; }
.page-head .sub{ color:var(--pc-muted) !important; }

/* ---------- Cards / panels ---------- */
.card,
.calendar-wrap,
.stat,
.shift-card,
.note-item,
.msg{
  background:var(--pc-card) !important;
  border:1px solid var(--pc-line) !important;
  color:var(--pc-text) !important;
  box-shadow:0 1px 2px rgba(0,0,0,.35) !important;
}
.card h2, .card h3{ color:#e9d5ff !important; }
.stat .num{ color:var(--pc-purple-3) !important; }
.stat .lab{ color:var(--pc-muted) !important; }

/* Inline whitey backgrounds used in templates */
[style*="background:#fff"],
[style*="background: #fff"],
[style*="background:#ffffff"],
[style*="background: #ffffff"],
[style*="background:#faf7ff"],
[style*="background: #faf7ff"],
[style*="background:#f9fafb"],
[style*="background: #f9fafb"],
[style*="background:#f3f4f6"],
[style*="background: #f3f4f6"]{
  background:var(--pc-card) !important;
  color:var(--pc-text) !important;
}
[style*="background:#f3e8ff"],
[style*="background: #f3e8ff"],
[style*="background:#ede9fe"],
[style*="background: #ede9fe"],
[style*="background:#ddd6fe"],
[style*="background: #ddd6fe"]{
  background:var(--pc-card-2) !important;
  color:var(--pc-text) !important;
}

/* ---------- Tables ---------- */
table{ color:var(--pc-text) !important; }
table th{
  color:#e9d5ff !important;
  background:#1f0f3a !important;
  border-bottom:1px solid var(--pc-line) !important;
}
table td{
  border-bottom:1px solid var(--pc-line) !important;
  color:var(--pc-text) !important;
  background:transparent !important;
}
table tbody tr:nth-child(even) td{ background:rgba(124,58,237,.05) !important; }
table tr:hover td{ background:rgba(124,58,237,.12) !important; }
/* legacy purple thead (kept readable) */
thead[style*="#7c3aed"] th,
thead[style*="#5b21b6"] th,
thead[style*="#6d28d9"] th,
tr[style*="#7c3aed"] th,
tr[style*="#5b21b6"] th{
  background:var(--pc-purple) !important;
  color:#fff !important;
}

/* ---------- Forms ---------- */
input[type=text],input[type=email],input[type=password],input[type=search],
input[type=date],input[type=time],input[type=datetime-local],input[type=number],
input[type=tel],input[type=url],textarea,select{
  background:#10061f !important;
  color:var(--pc-text) !important;
  border:1px solid var(--pc-line) !important;
}
input::placeholder,textarea::placeholder{ color:#7c6aa8 !important; }
input:focus,textarea:focus,select:focus{
  border-color:var(--pc-purple) !important;
  box-shadow:0 0 0 3px rgba(124,58,237,.25) !important;
}
label{ color:var(--pc-muted) !important; }
select option{ background:#10061f; color:var(--pc-text); }

/* ---------- Buttons ---------- */
.btn{ font-weight:600; }
.btn-primary{
  background:var(--pc-purple) !important;
  color:#fff !important;
  border:0 !important;
}
.btn-primary:hover{ background:var(--pc-purple-2) !important; }
.btn-ghost{
  background:transparent !important;
  color:#e9d5ff !important;
  border:1px solid var(--pc-line) !important;
}
.btn-ghost:hover{ background:rgba(124,58,237,.15) !important; }
.btn-danger{ background:var(--pc-err) !important; color:#fff !important; }
button.ai-btn{
  background:rgba(124,58,237,.18) !important;
  color:#e9d5ff !important;
  border:1px solid var(--pc-line) !important;
}
button.ai-btn:hover{ background:rgba(124,58,237,.32) !important; }

/* generic <button> not otherwise styled: keep purple */
button:not(.btn):not(.voice-mic):not(.nav-toggle):not(.ai-btn):not([class*="qc"]):not([style*="background"]){
  background:var(--pc-purple);
  color:#fff;
  border:0;
}

/* ---------- Tags / pills ---------- */
.tag{ background:rgba(124,58,237,.22) !important; color:#e9d5ff !important; }
.tag.scheduled{ background:rgba(59,130,246,.22) !important; color:#bfdbfe !important; }
.tag.in_progress{ background:rgba(245,158,11,.22) !important; color:#fde68a !important; }
.tag.completed,.tag.active{ background:rgba(16,185,129,.22) !important; color:#a7f3d0 !important; }
.tag.cancelled,.tag.high,.tag.severe{ background:rgba(239,68,68,.22) !important; color:#fecaca !important; }
.tag.medium{ background:rgba(245,158,11,.22) !important; color:#fde68a !important; }
.tag.low,.tag.inactive{ background:rgba(148,163,184,.22) !important; color:#cbd5e1 !important; }

/* Compliance badges (keep semantic colours on dark) */
.badge-green,[class*="compl-ok"],.tag.ok{ background:rgba(16,185,129,.22) !important; color:#a7f3d0 !important; border:1px solid rgba(16,185,129,.45) !important; }
.badge-amber,[class*="compl-warn"],.tag.warn{ background:rgba(245,158,11,.22) !important; color:#fde68a !important; border:1px solid rgba(245,158,11,.45) !important; }
.badge-red,[class*="compl-bad"],.tag.bad{ background:rgba(239,68,68,.22) !important; color:#fecaca !important; border:1px solid rgba(239,68,68,.45) !important; }

/* ---------- Flash messages ---------- */
.flash.ok{ background:rgba(16,185,129,.15) !important; color:#a7f3d0 !important; border:1px solid rgba(16,185,129,.45) !important; }
.flash.error{ background:rgba(239,68,68,.15) !important; color:#fecaca !important; border:1px solid rgba(239,68,68,.45) !important; }

/* ---------- Notes / messages ---------- */
.note-head .author{ color:#fff !important; }
.note-head{ color:var(--pc-muted) !important; }
.note-body{ color:#e9d5ff !important; }
.summary{
  background:rgba(124,58,237,.12) !important;
  border-left:3px solid var(--pc-purple) !important;
  color:#e9d5ff !important;
}
.msg{ background:var(--pc-card-2) !important; border:1px solid var(--pc-line) !important; }
.msg .who{ color:var(--pc-purple-3) !important; }
.msg .when{ color:var(--pc-muted) !important; }
.msg .body{ color:var(--pc-text) !important; }

/* ---------- Empty state ---------- */
.empty{ color:var(--pc-muted) !important; }

/* ---------- GPS / pin chip ---------- */
.gps-pin{ background:rgba(124,58,237,.18) !important; color:#e9d5ff !important; }

/* ---------- Modals (generic dialogs) ---------- */
dialog, .modal, .modal-content, [role="dialog"]{
  background:var(--pc-card) !important;
  color:var(--pc-text) !important;
  border:1px solid var(--pc-line) !important;
}
.modal-backdrop, .backdrop{ background:rgba(10,5,25,.7) !important; }

/* ---------- FullCalendar dark theme ---------- */
.fc{ color:var(--pc-text) !important; }
.fc .fc-toolbar-title{ color:#fff !important; }
.fc .fc-button{
  background:var(--pc-purple) !important;
  border:1px solid var(--pc-purple-2) !important;
  color:#fff !important;
}
.fc .fc-button:hover{ background:var(--pc-purple-2) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active{
  background:var(--pc-purple-2) !important;
  border-color:var(--pc-purple-2) !important;
}
.fc-theme-standard td,.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid{
  border-color:var(--pc-line) !important;
}
.fc-theme-standard .fc-list{ border-color:var(--pc-line) !important; }
.fc .fc-daygrid-day, .fc .fc-timegrid-slot, .fc .fc-list-day-cushion{
  background:var(--pc-card) !important;
}
.fc .fc-day-today{ background:rgba(124,58,237,.15) !important; }
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text{ color:#e9d5ff !important; }
.fc .fc-list-event:hover td{ background:rgba(124,58,237,.18) !important; }
.fc .fc-event{ border-color:var(--pc-purple-2) !important; }

/* ---------- Charts (canvas / svg backgrounds) ---------- */
canvas, svg.chart, .chart-wrap{ background:transparent !important; }

/* ---------- Shift tabs (overrides shift_tabs.css if light) ---------- */
.shift-tabs, .shift-tabs *{ color:var(--pc-text); }
.shift-tabs a, .shift-tabs button{ color:#e9d5ff !important; }
.shift-tabs .active, .shift-tabs a.active{ color:#fff !important; border-color:var(--pc-purple) !important; }

/* ---------- Worker bubbles (already purple) ---------- */
.worker-bubble{ border-color:var(--pc-line) !important; }

/* ---------- Mobile responsive nav drawer recolour ---------- */
@media(max-width:899px){
  .nav-links,.user-chip{ border-top-color:var(--pc-line) !important; }
  .nav-links a{ border-bottom-color:var(--pc-line) !important; }
  .nav-links a.active{ background:rgba(124,58,237,.18) !important; color:#fff !important; border-left-color:var(--pc-purple) !important; }
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-track{ background:#10061f; }
::-webkit-scrollbar-thumb{ background:#3b2566; border-radius:6px; }
::-webkit-scrollbar-thumb:hover{ background:#5b21b6; }

/* ---------- HR / dividers ---------- */
hr{ border-color:var(--pc-line) !important; background:var(--pc-line) !important; }

/* ---------- Code / pre ---------- */
code, pre{ background:#10061f !important; color:#e9d5ff !important; border:1px solid var(--pc-line); border-radius:6px; padding:2px 6px; }

/* end theme-dark.css */

/* =========================================================================
   Page-specific class overrides
   ========================================================================= */

/* login.html uses .pc-* classes in a page-local <style> after theme-dark */
.pc-card{
  background:var(--pc-card) !important;
  border:1px solid var(--pc-line) !important;
  color:var(--pc-text) !important;
  box-shadow:0 4px 14px rgba(0,0,0,.45) !important;
}
.pc-h{ color:#fff !important; }
.pc-sub{ color:var(--pc-muted) !important; }
.pc-field label{ color:#e9d5ff !important; }
.pc-field input{
  background:#10061f !important;
  color:var(--pc-text) !important;
  border:1.5px solid var(--pc-line) !important;
}
.pc-field input:focus{
  border-color:var(--pc-purple) !important;
  box-shadow:0 0 0 3px rgba(124,58,237,.25) !important;
}
.pc-btn-primary{ background:var(--pc-purple) !important; color:#fff !important; }
.pc-btn-primary:hover{ background:var(--pc-purple-2) !important; }
.pc-flash.error{
  background:rgba(239,68,68,.15) !important;
  color:#fecaca !important;
  border:1px solid rgba(239,68,68,.45) !important;
}
.pc-footer-note{ color:var(--pc-muted) !important; }
