/* =============================================================================
   campistry_health.css — Campistry Health Styles v1.0
   Product Color: Purple #8B5CF6
   ============================================================================= */

:root {
    --health: #8B5CF6;
    --health-dark: #7C3AED;
    --health-light: #A78BFA;
    --health-tint: rgba(139,92,246,0.08);
    --health-border: rgba(139,92,246,0.2);
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --border-light: #E2E8F0;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --slate-50: #F8FAFC; --slate-100: #F1F5F9; --slate-200: #E2E8F0; --slate-300: #CBD5E1;
    --slate-400: #94A3B8; --slate-500: #64748B; --slate-600: #475569; --slate-700: #334155;
    --slate-800: #1E293B; --slate-900: #0F172A;
    --font: 'DM Sans', system-ui, -apple-system, sans-serif;
    --r: 8px; --r2: 12px; --r3: 16px;
    --ease: cubic-bezier(.16,1,.3,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--slate-800); background: var(--bg-primary); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ══ HEADER ══════════════════════════════════════════════════ */
.app-header { display:flex; align-items:center; justify-content:space-between; height:56px; padding:0 16px; background:#fff; border-bottom:1px solid var(--slate-200); position:sticky; top:0; z-index:30; }
.header-left { display:flex; align-items:center; gap:12px; flex:0 0 auto; }
.header-right { display:flex; align-items:center; gap:10px; flex:0 0 auto; }
/* Quick-switch app bar: the one zone allowed to shrink and internally
   scroll — never the nav controls or the sync badge/avatar either side. */
.app-header-center { display:flex; align-items:center; justify-content:center; min-width:0; overflow:hidden; flex:1 1 auto; }
.app-header .quick-switch-bar { position:static; transform:none; max-width:100%; }
.app-logo-full { display:block; flex-shrink:0; object-fit:contain; vertical-align:middle; }
.header-app-switch { display:flex; align-items:center; margin-left:12px; transition:opacity .2s; }
.header-app-switch:hover { opacity:.7; }
.hamburger-btn { display:flex; flex-direction:column; justify-content:center; gap:4px; width:36px; height:36px; padding:8px; border:1px solid var(--slate-200); border-radius:var(--r); background:#fff; }
.hamburger-btn span { display:block; height:2px; background:var(--slate-700); border-radius:1px; }
.hamburger-btn:hover { border-color:var(--health); background:var(--health-tint); }
.sync-badge { display:flex; align-items:center; gap:5px; padding:4px 10px; background:var(--slate-100); border-radius:999px; font-size:.7rem; font-weight:500; color:var(--slate-500); }
.sync-dot { width:8px; height:8px; border-radius:50%; background:#10B981; }
.nav-user { font-size:.75rem; color:var(--slate-500); font-weight:500; }

/* ══ SIDEBAR ═════════════════════════════════════════════════ */
/* Dark sidebar shell — matches the standard Campistry pattern (see
   campistry_snacks.css's .sidebar for the canonical reference): same navy
   gradient, same rgba(slate) item/label/dot values. Only the "active"
   accent uses Health's own purple instead of another product's color. */
.sidebar-backdrop { display:none; position:fixed; inset:0; background:rgba(2,6,23,.5); z-index:45; }
body.sidebar-open .sidebar-backdrop { display:block; }
.sidebar { position:fixed; top:56px; left:0; bottom:0; width:240px; background:linear-gradient(180deg,#0a0f1e 0%,#020617 100%); border-right:1px solid rgba(148,163,184,.08); padding:1rem .85rem; display:flex; flex-direction:column; gap:.5rem; transform:translateX(-100%); transition:transform .25s var(--ease); z-index:50; overflow-y:auto; }
body.sidebar-open .sidebar { transform:translateX(0); }

.sidebar-label { font-size:.65rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:rgba(148,163,184,.5); padding:10px 12px 4px; margin-bottom:0; }
.sidebar-item { display:flex; align-items:center; gap:.6rem; padding:.55rem .7rem; border-radius:var(--r); border:1px solid transparent; background:none; color:rgba(203,213,225,.7); font-size:.85rem; font-weight:500; cursor:pointer; text-align:left; width:100%; margin-bottom:.2rem; transition:all .2s var(--ease); }
.sidebar-dot { width:8px; height:8px; border-radius:999px; background:rgba(100,116,139,.4); flex-shrink:0; transition:all .2s var(--ease); }
.sidebar-item:hover { background:rgba(148,163,184,.08); color:rgba(241,245,249,.95); }
.sidebar-item:hover .sidebar-dot { background:rgba(148,163,184,.5); transform:scale(1.2); }
.sidebar-item.active { background:rgba(139,92,246,0.15); color:#fff; border-color:rgba(139,92,246,0.3); font-weight:600; }
.sidebar-item.active .sidebar-dot { background:var(--health); box-shadow:0 0 8px rgba(139,92,246,.4); transform:scale(1.3); }
.sb-badge { font-size:.65rem; font-weight:700; padding:1px 6px; border-radius:10px; background:rgba(139,92,246,.25); color:#C4B5FD; margin-left:auto; }
.sb-badge.warn { background:rgba(220,38,38,.25); color:#FCA5A5; }

/* The sidebar stays hamburger-triggered at every screen size — matches
   Me/Live/Flow (there is deliberately no desktop auto-pin/@media override
   here, same as campistry_snacks.css/campistry_me.css/campistry_live.css). */

/* ══ MAIN CONTENT ════════════════════════════════════════════ */
.app-content { padding:1.25rem 1.5rem 3rem; }
.health-page { display:none; }
.health-page.active { display:block; }

/* ══ PAGE HERO ════════════════════════════════════════════════ */
.page-hero { display:flex; align-items:center; gap:14px; margin-bottom:22px; padding-bottom:18px; border-bottom:1px solid #F1F5F9; }
.page-hero-icon { width:48px; height:48px; border-radius:12px; background:rgba(139,92,246,0.08); color:var(--health); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.page-hero h1 { font-size:1.35rem; font-weight:800; color:#0F172A; line-height:1.2; }
.page-hero p { font-size:.82rem; color:#94A3B8; margin-top:3px; }

/* ══ PAGE HEADER (legacy — keep for compat) ══════════════════ */
.page-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.page-title { font-size:1.25rem; font-weight:800; color:var(--slate-900); line-height:1.2; }
.page-subtitle { font-size:.8125rem; color:var(--slate-500); margin-top:2px; }
.page-actions { display:flex; gap:8px; align-items:center; }

/* ══ STATS GRID ══════════════════════════════════════════════ */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:14px; margin-bottom:20px; }
.stat-card { background:#fff; border-radius:12px; padding:18px 20px; display:flex; align-items:center; gap:14px; box-shadow:0 1px 3px rgba(15,23,42,.06),0 1px 2px rgba(15,23,42,.04); border:1px solid var(--slate-200); }
.stat-icon { width:44px; height:44px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stat-icon.blue { background:#EFF6FF; color:#2563EB; }
.stat-icon.green { background:#F0FDF4; color:#16A34A; }
.stat-icon.red { background:#FEF2F2; color:#DC2626; }
.stat-icon.amber { background:#FFFBEB; color:#D97706; }
.stat-icon.purple { background:rgba(139,92,246,0.08); color:var(--health); }
.stat-value { font-size:1.5rem; font-weight:800; color:var(--slate-900); line-height:1; }
.stat-label { font-size:.75rem; color:var(--slate-500); margin-top:2px; }

/* ══ CARDS ═══════════════════════════════════════════════════ */
.card { background:#fff; border-radius:14px; box-shadow:0 1px 4px rgba(15,23,42,.06),0 1px 2px rgba(15,23,42,.04); border:1px solid #E2E8F0; margin-bottom:18px; overflow:hidden; }
.card-header { padding:14px 20px; border-bottom:1px solid #F1F5F9; display:flex; align-items:center; justify-content:space-between; }
.card-header h2 { font-size:.93rem; font-weight:700; margin:0; color:#1E293B; }
.card-body { padding:16px 20px; }

/* ══ DATA TABLE ══════════════════════════════════════════════ */
.data-table { width:100%; border-collapse:collapse; }
.data-table th { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:#64748B; padding:10px 14px; border-bottom:1px solid #E2E8F0; text-align:left; }
.data-table td { padding:11px 14px; border-bottom:1px solid #F1F5F9; font-size:.8125rem; }
.data-table tr:last-child td { border-bottom:none; }
.data-table tr:hover td { background:#F8FAFC; }

.med-avatar { display:flex; align-items:center; justify-content:center; width:40px; height:40px; font-size:.75rem; border-radius:50%; color:#fff; font-weight:700; flex-shrink:0; }

/* ══ MEDICATION QUEUE (Dashboard) ════════════════════════════ */
.med-item { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid #F1F5F9; }
.med-item:last-child { border-bottom:none; }
.med-item.upcoming { border-left:3px solid var(--health); padding-left:10px; margin-left:-13px; }
.med-info { flex:1; min-width:0; }
.med-name { font-size:.85rem; font-weight:700; color:var(--slate-900); }
.med-detail { font-size:.75rem; color:var(--slate-500); margin-top:2px; }
.med-actions { display:flex; gap:8px; flex-shrink:0; }
.btn-give, .btn-skip { padding:6px 12px; border-radius:999px; font-size:.72rem; font-weight:700; cursor:pointer; border:1px solid transparent; font-family:var(--font); }
.btn-give { background:#F0FDF4; color:#16A34A; }
.btn-give:hover { background:#DCFCE7; }
.btn-skip { background:var(--slate-100); color:var(--slate-500); }
.btn-skip:hover { background:var(--slate-200); }

/* ══ VISIT CARDS (Dashboard recent visits + Nighttime Care) ═══ */
.visit-card { display:flex; gap:12px; padding:10px 0; border-bottom:1px solid #F1F5F9; }
.visit-card:last-child { border-bottom:none; }
.visit-time { flex-shrink:0; width:64px; font-size:.72rem; font-weight:600; color:var(--slate-500); }
.visit-body { flex:1; min-width:0; }
.visit-header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.visit-camper { font-size:.85rem; font-weight:700; color:var(--slate-900); }
.visit-complaint { font-size:.8rem; color:var(--slate-600); margin-top:2px; }
.visit-treatment { display:flex; align-items:center; gap:4px; font-size:.75rem; color:var(--health); margin-top:4px; }

/* ══ ALLERGY ALERT CARDS (Dashboard) ══════════════════════════ */
.allergy-card { padding:10px 12px; border-radius:var(--r); border-left:3px solid var(--slate-300); background:var(--slate-50); margin-bottom:8px; }
.allergy-card:last-child { margin-bottom:0; }
.allergy-card.severe { border-left-color:#DC2626; background:#FEF2F2; }
.allergy-card.moderate { border-left-color:#D97706; background:#FFFBEB; }
.allergy-camper { display:flex; align-items:center; gap:8px; font-size:.85rem; font-weight:700; color:var(--slate-900); }
.allergy-detail { font-size:.8rem; color:var(--slate-600); margin-top:4px; }

/* ══ BADGES ══════════════════════════════════════════════════ */
.badge { display:inline-flex; align-items:center; padding:2px 9px; border-radius:999px; font-size:.68rem; font-weight:700; }
.badge-ok { background:#F0FDF4; color:#16A34A; }
.badge-warn { background:#FFFBEB; color:#D97706; }
.badge-error { background:#FEF2F2; color:#DC2626; }
.badge-info { background:#EFF6FF; color:#2563EB; }
.badge-neutral { background:#F1F5F9; color:#475569; }
.badge-gray { background:#F1F5F9; color:#64748B; }
.badge-green { background:#F0FDF4; color:#16A34A; }
.badge-red { background:#FEF2F2; color:#DC2626; }
.badge-amber { background:#FFFBEB; color:#D97706; }
.badge-purple { background:var(--health-tint); color:var(--health); }
.badge-blue { background:#EFF6FF; color:#2563EB; }

/* ══ BUTTONS ═════════════════════════════════════════════════ */
.btn { display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border-radius:var(--r); font-size:.8rem; font-weight:600; transition:all .15s; border:1px solid transparent; cursor:pointer; font-family:var(--font); }
.btn-primary { background:var(--health); color:#fff; border-color:var(--health); }
.btn-primary:hover { background:var(--health-dark); box-shadow:0 2px 8px rgba(139,92,246,.2); }
.btn-secondary { background:#fff; color:var(--slate-700); border:1px solid var(--slate-200); }
.btn-secondary:hover { background:var(--slate-50); }
.btn-sm { padding:6px 14px; font-size:.77rem; }

/* ══ SEARCH BAR ══════════════════════════════════════════════ */
.search-bar { display:flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--slate-200); border-radius:8px; padding:6px 10px; margin-bottom:14px; }
.search-bar input { border:none; outline:none; background:none; font-size:.8125rem; font-family:inherit; flex:1; }
.search-bar svg { color:var(--slate-400); flex-shrink:0; }

/* ══ MODALS ══════════════════════════════════════════════════ */
.modal-overlay { position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,.5); display:none; align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal { background:#fff; border-radius:14px; width:95%; max-width:520px; max-height:85vh; overflow:auto; box-shadow:0 20px 60px rgba(0,0,0,.2); }
.modal.modal-lg { max-width:640px; }
.cp-section { margin-bottom:18px; }
.cp-section:last-child { margin-bottom:0; }
.cp-section-title { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--slate-400); margin-bottom:8px; }
.cp-grid { display:grid; grid-template-columns:1fr 1fr; gap:.5rem 1rem; }
.cp-row { font-size:.85rem; }
.cp-row-label { color:var(--slate-400); font-size:.72rem; margin-bottom:1px; }
.cp-row-val { color:var(--slate-900); font-weight:500; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--slate-100); }
.modal-header h3 { margin:0; font-size:1rem; font-weight:700; color:var(--slate-900); }
.modal-close { background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--slate-400); padding:0; }
.modal-body { padding:16px 20px; }
.modal-footer { display:flex; justify-content:flex-end; gap:8px; padding:12px 20px; border-top:1px solid var(--slate-100); }
.form-group { margin-bottom:14px; }
.form-label { display:block; font-size:.75rem; font-weight:600; color:var(--slate-600); margin-bottom:4px; }
.form-input { width:100%; padding:8px 12px; border:1px solid var(--slate-300); border-radius:var(--r); font-size:.8125rem; font-family:inherit; background:#fff; box-sizing:border-box; }
.form-input:focus { outline:none; border-color:var(--health); box-shadow:0 0 0 3px rgba(139,92,246,.1); }
.form-select { width:100%; padding:8px 12px; border:1px solid var(--slate-300); border-radius:var(--r); font-size:.8125rem; font-family:inherit; background:#fff; box-sizing:border-box; }
.form-select:focus { outline:none; border-color:var(--health); box-shadow:0 0 0 3px rgba(139,92,246,.1); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-hint { font-size:.72rem; color:var(--slate-400); margin-top:4px; }

/* ══ EMPTY STATE ═════════════════════════════════════════════ */
.empty-state { text-align:center; padding:2rem; color:var(--slate-400); font-size:.875rem; }

/* ══ TOAST ═══════════════════════════════════════════════════ */
.toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%) translateY(100px); background:#1e293b; color:#fff; padding:10px 20px; border-radius:8px; font-size:.8125rem; font-weight:500; z-index:20000; opacity:0; transition:all .25s ease; pointer-events:none; box-shadow:0 8px 24px rgba(0,0,0,.2); }
.toast.show { transform:translateX(-50%) translateY(0); opacity:1; }
.toast.error { background:#DC2626; }

/* ══ BOTTOM NAV ══════════════════════════════════════════════ */
.cs-bnav { display:none; }
@media (max-width: 768px) {
    .cs-bnav { display:flex; position:fixed; bottom:0; left:0; right:0; height:60px; background:#fff; border-top:1px solid #E2E8F0; z-index:200; }
    .cs-bnav-item { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font-size:.62rem; font-weight:600; color:#64748B; border:none; background:none; cursor:pointer; padding:6px 0; font-family:var(--font); }
    .cs-bnav-item svg { width:20px; height:20px; }
    .cs-bnav-item.active { color:var(--health); }
    .app-content { padding-bottom:80px; }
}

/* ══ MOBILE RESPONSIVE ════════════════════════════════════════ */
@media (max-width: 768px) {
    .app-header { height:auto; min-height:48px; padding:8px 10px; flex-wrap:wrap; }
    .header-app-switch { display:none; }
    .app-content { padding:12px 12px 80px; }
    .stats-grid { grid-template-columns:repeat(2,1fr); }
    .activity-grid { grid-template-columns:1fr; }
    .page-header { flex-direction:column; }
    .cs-bnav { display:flex; }
}
