/* ==========================================================================
   Neuro App — Mobile-first UI styles (spec section 4/24)
   ========================================================================== */

:root {
    --na-primary: #2f6fed;
    --na-primary-dark: #1f4fb8;
    --na-danger: #e0303b;
    --na-success: #1e9e6a;
    --na-warning: #d98c00;
    --na-bg: #f4f6fb;
    --na-card-bg: #ffffff;
    --na-text: #1c2536;
    --na-text-muted: #6b7686;
    --na-radius: 16px;
    --na-header-h: 56px;
    --na-nav-h: 64px;
}

* { box-sizing: border-box; }

body.na-body {
    background: var(--na-bg);
    color: var(--na-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding-top: var(--na-header-h);
    padding-bottom: calc(var(--na-nav-h) + 12px);
    min-height: 100vh;
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

/* Header */
.na-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    max-width: 560px;
    margin: 0 auto;
    height: var(--na-header-h);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    z-index: 1000;
}
.na-header-title { font-weight: 700; font-size: 1.05rem; }
.na-icon-btn {
    border: none; background: transparent; font-size: 1.25rem; color: var(--na-text);
    width: 44px; height: 44px; border-radius: 50%; position: relative;
}
.na-icon-btn:active { background: rgba(0,0,0,.06); }
.na-badge {
    position: absolute; top: 4px; right: 4px; background: var(--na-danger); color: #fff;
    font-size: .62rem; min-width: 16px; height: 16px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center; padding: 0 3px;
}

.na-main { padding: 16px; }

/* Cards */
.na-card {
    background: var(--na-card-bg);
    border-radius: var(--na-radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(20,30,60,.06);
}
.na-card-title { font-weight: 700; font-size: .95rem; margin-bottom: 8px; }
.na-card-subtle { color: var(--na-text-muted); font-size: .85rem; }

/* Quick action grid */
.na-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
.na-quick-action {
    background: var(--na-card-bg);
    border-radius: var(--na-radius);
    padding: 18px 12px;
    text-align: center;
    text-decoration: none;
    color: var(--na-text);
    box-shadow: 0 2px 10px rgba(20,30,60,.06);
    font-weight: 600;
    font-size: .85rem;
}
.na-quick-action i { font-size: 1.6rem; display: block; margin-bottom: 6px; color: var(--na-primary); }

/* Bottom navigation */
.na-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-width: 560px;
    margin: 0 auto;
    height: var(--na-nav-h);
    background: #fff;
    display: flex;
    box-shadow: 0 -1px 6px rgba(0,0,0,.08);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.na-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; color: var(--na-text-muted); font-size: .68rem; gap: 2px;
}
.na-nav-item i { font-size: 1.25rem; }
.na-nav-item.active { color: var(--na-primary); }

/* Emergency floating button */
.na-emergency-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--na-nav-h) + 16px);
    width: 58px; height: 58px;
    border-radius: 50%;
    background: var(--na-danger);
    color: #fff;
    border: none;
    font-size: 1.4rem;
    box-shadow: 0 6px 16px rgba(224,48,59,.45);
    z-index: 1001;
}
.na-emergency-fab:active { transform: scale(.95); }

/* Severity indicators (never rely on color alone — text label always shown) */
.na-severity { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .78rem; }
.na-severity::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.na-severity-critical::before { background: var(--na-danger); }
.na-severity-high::before { background: #ff7a3d; }
.na-severity-moderate::before { background: var(--na-warning); }
.na-severity-low::before { background: var(--na-success); }

/* Bottom sheet */
.na-sheet-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1100; display: none;
}
.na-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
    background: #fff; border-radius: 20px 20px 0 0; padding: 16px; z-index: 1101;
    transform: translateY(100%); transition: transform .25s ease;
}
.na-sheet.open { transform: translateY(0); }
.na-sheet-backdrop.open { display: block; }

/* Toasts */
.na-toast-container {
    position: fixed; bottom: calc(var(--na-nav-h) + 16px); left: 0; right: 0;
    max-width: 560px; margin: 0 auto; padding: 0 16px; z-index: 1200;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.na-toast {
    background: #22293b; color: #fff; padding: 10px 14px; border-radius: 10px;
    font-size: .85rem; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.na-toast.na-toast-error { background: var(--na-danger); }
.na-toast.na-toast-success { background: var(--na-success); }

/* Skeleton loaders */
.na-skeleton {
    background: linear-gradient(90deg, #e9edf5 25%, #f4f6fb 37%, #e9edf5 63%);
    background-size: 400% 100%;
    animation: na-shimmer 1.4s ease infinite;
    border-radius: 8px;
}
@keyframes na-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Forms */
.na-form input, .na-form select, .na-form textarea {
    border-radius: 12px; padding: 12px 14px; font-size: 1rem;
}
.na-sticky-actions {
    position: sticky; bottom: 0; background: #fff; padding: 12px 0; margin-top: 8px;
}
.na-btn-primary {
    background: var(--na-primary); border: none; color: #fff; border-radius: 12px;
    padding: 12px; font-weight: 600; width: 100%;
}

@media (min-width: 576px) {
    body.na-body { border-left: 1px solid #e4e8f0; border-right: 1px solid #e4e8f0; }
}

/* ==========================================================================
   Vibrant tile / colour system — matches the reference patient-app mockups
   ========================================================================== */

:root {
    --na-tile-blue: #3a7bfd;   --na-tile-blue-dk: #2457c9;
    --na-tile-green: #22b573;  --na-tile-green-dk: #178a56;
    --na-tile-orange: #ff9f43; --na-tile-orange-dk: #e8801a;
    --na-tile-purple: #8b5cf6; --na-tile-purple-dk: #6d3ff0;
    --na-tile-pink: #ff5c8a;   --na-tile-pink-dk: #e83a6a;
    --na-tile-teal: #14b8a6;   --na-tile-teal-dk: #0e9385;
    --na-tile-red: #f0384a;    --na-tile-red-dk: #c81e2f;
    --na-tile-indigo: #5b6ee1; --na-tile-indigo-dk: #3f52c9;
    --na-ink-soft: #64748b;
}

/* Quick-action tile grid (replaces the old plain-link quick actions) */
.na-tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.na-tile {
    border-radius: 18px; padding: 16px 14px; color: #fff; text-decoration: none;
    display: flex; flex-direction: column; gap: 22px; min-height: 92px;
    box-shadow: 0 6px 14px rgba(20,30,60,.14); position: relative; overflow: hidden;
}
.na-tile i { font-size: 1.4rem; }
.na-tile span { font-weight: 600; font-size: .88rem; line-height: 1.2; }
.na-tile-blue { background: linear-gradient(135deg, var(--na-tile-blue), var(--na-tile-blue-dk)); }
.na-tile-green { background: linear-gradient(135deg, var(--na-tile-green), var(--na-tile-green-dk)); }
.na-tile-orange { background: linear-gradient(135deg, var(--na-tile-orange), var(--na-tile-orange-dk)); }
.na-tile-purple { background: linear-gradient(135deg, var(--na-tile-purple), var(--na-tile-purple-dk)); }
.na-tile-pink { background: linear-gradient(135deg, var(--na-tile-pink), var(--na-tile-pink-dk)); }
.na-tile-teal { background: linear-gradient(135deg, var(--na-tile-teal), var(--na-tile-teal-dk)); }
.na-tile-red { background: linear-gradient(135deg, var(--na-tile-red), var(--na-tile-red-dk)); }
.na-tile-indigo { background: linear-gradient(135deg, var(--na-tile-indigo), var(--na-tile-indigo-dk)); }

/* Avatars */
.na-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #eef1f8; flex-shrink: 0; }
.na-avatar-initials {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.1rem;
    background: linear-gradient(135deg, var(--na-tile-blue), var(--na-tile-blue-dk));
}
.na-avatar-sm, .na-avatar-initials-sm { width: 38px; height: 38px; font-size: .85rem; }

/* Solid colour status / severity pills (distinct from the outline .na-severity dot) */
.na-pill { display: inline-flex; align-items: center; padding: 4px 13px; border-radius: 12px; font-size: .7rem; font-weight: 700; color: #fff; white-space: nowrap; }
.na-pill-critical, .na-pill-high { background: var(--na-tile-red); }
.na-pill-medium, .na-pill-moderate { background: var(--na-tile-orange); }
.na-pill-low { background: var(--na-tile-green); }
.na-pill-active { background: var(--na-tile-green); }
.na-pill-completed { background: #94a3b8; }
.na-pill-inactive, .na-pill-discharged { background: #94a3b8; }

/* Pill-style tab group (Current/All, Day 1/2/3, Active/Passive) */
.na-pill-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; }
.na-pill-tab {
    flex-shrink: 0; padding: 8px 18px; border-radius: 20px; background: #eef1f8; color: var(--na-ink-soft);
    font-weight: 600; font-size: .82rem; border: none; white-space: nowrap;
}
.na-pill-tab.active { background: var(--na-primary); color: #fff; }

/* Row icon avatar (used for medicines, diet items, exercises) */
.na-row-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; color: #fff; font-size: 1.15rem;
    display: flex; align-items: center; justify-content: center;
}

/* Branded auth hero (splash / OTP screens) */
.na-auth-hero {
    background: linear-gradient(165deg, #0d1b34 0%, #1f4fb8 55%, #3a7bfd 100%);
    color: #fff; padding: 40px 26px 32px; text-align: center;
    border-radius: 0 0 28px 28px; margin: -16px -16px 22px;
}
.na-auth-hero .na-auth-mark {
    width: 60px; height: 60px; border-radius: 18px; background: rgba(255,255,255,.14);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.7rem; margin-bottom: 14px;
}
.na-auth-hero h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; }
.na-auth-hero p { font-size: .82rem; opacity: .82; margin: 0; }

/* OTP digit boxes */
.na-otp-row { display: flex; gap: 9px; justify-content: center; margin: 18px 0; }
.na-otp-box {
    width: 44px; height: 54px; border: 2px solid #e2e8f0; border-radius: 12px;
    text-align: center; font-size: 1.25rem; font-weight: 700; color: var(--na-text);
}
.na-otp-box:focus { border-color: var(--na-primary); outline: none; }

/* Emergency call card (dedicated Emergency Contact screen) */
.na-emergency-card {
    background: linear-gradient(160deg, var(--na-tile-red), var(--na-tile-red-dk));
    color: #fff; border-radius: 20px; padding: 30px 20px; text-align: center; margin-bottom: 16px;
}
.na-emergency-call-btn {
    width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.16);
    display: flex; align-items: center; justify-content: center; font-size: 1.7rem; margin: 0 auto 14px; border: none; color: #fff;
}
.na-emergency-card h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 2px; }
.na-emergency-card p { font-size: .8rem; opacity: .85; margin: 0; }

.na-contact-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef1f8;
}
.na-contact-row:last-child { border-bottom: none; }
.na-contact-row .na-contact-name { font-weight: 600; font-size: .9rem; }
.na-contact-row .na-contact-sub { color: var(--na-ink-soft); font-size: .78rem; }
.na-contact-call-btn {
    margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: none;
    background: var(--na-tile-green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
}

/* Profile screen key/value rows */
.na-kv-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef1f8; }
.na-kv-row:last-child { border-bottom: none; }
.na-kv-row i { width: 30px; color: var(--na-primary); font-size: 1.05rem; text-align: center; }
.na-kv-row .na-kv-label { font-size: .72rem; color: var(--na-ink-soft); }
.na-kv-row .na-kv-value { font-size: .9rem; font-weight: 500; }
