/* 🩺 BioScan AI 24h Dark Glassmorphism Design System */
:root {
    --bg-dark: #090d16;
    --card-bg: rgba(15, 23, 42, 0.75);
    --border-color: rgba(56, 189, 248, 0.2);
    --cyan-glow: #06b6d4;
    --emerald-glow: #10b981;
    --amber-glow: #f59e0b;
    --ruby-glow: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-heading: 'Outfit', 'Do Hyeon', sans-serif;
    --font-body: 'Noto Sans KR', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.15), transparent 70%),
                      radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.1), transparent 60%);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 16px;
}

.app-container {
    width: 100%;
    max-width: 1320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* HEADER */
.app-header {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-badge {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--cyan-glow), var(--emerald-glow));
    color: #000;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
}

.brand-logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff, var(--cyan-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.emergency-hotline {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 6px 12px;
    border-radius: 10px;
}

.hotline-lbl {
    font-size: 0.7rem;
    color: #fca5a5;
    display: block;
}

.hotline-num {
    font-size: 0.95rem;
    font-weight: 900;
    color: #ef4444;
}

.hdr-btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-danger {
    background: var(--ruby-glow);
    color: #fff;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.btn-gold {
    background: #fbbf24;
    color: #000;
}

.hdr-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* FEATURE TABS */
.feature-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    flex: 1;
    min-width: 180px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active, .tab-btn:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(16, 185, 129, 0.2));
    border-color: var(--cyan-glow);
    color: #fff;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

/* WORKSPACE TAB CONTENT */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.suite-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
}

.card-header-row h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--cyan-glow);
}

/* CHIPS */
.body-part-chips, .mental-exam-chips, .sign-cat-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip.active, .chip:hover {
    background: var(--cyan-glow);
    color: #000;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* SCANNER MAIN LAYOUT */
.scanner-main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .scanner-main-layout {
        grid-template-columns: 1fr;
    }
}

.camera-viewport-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--cyan-glow);
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-overlay-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 240px;
    border: 1px dashed rgba(6, 182, 212, 0.5);
    pointer-events: none;
}

.target-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--cyan-glow);
    border-style: solid;
}

.top-left { top: 0; left: 0; border-width: 4px 0 0 4px; }
.top-right { top: 0; right: 0; border-width: 4px 4px 0 0; }
.bottom-left { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
.bottom-right { bottom: 0; right: 0; border-width: 0 4px 4px 0; }

.scan-laser-line {
    position: absolute;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--cyan-glow), transparent);
    box-shadow: 0 0 15px var(--cyan-glow);
    animation: scanLaser 2s infinite ease-in-out;
}

@keyframes scanLaser {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

.scan-status-badge {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fbbf24;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.camera-control-row {
    display: flex;
    gap: 10px;
}

.btn-cam {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: all 0.2s ease;
}

.btn-cam.start { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #3b82f6; }
.btn-cam.scan { background: var(--emerald-glow); color: #000; box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
.btn-cam.upload { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); }

.btn-cam:hover { transform: translateY(-2px); }

/* DIAGNOSTIC RESULTS */
.diagnostic-result-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-header h4 { font-size: 1rem; color: var(--text-main); }

.status-indicator-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 900;
}

.status-indicator-badge.normal { background: rgba(16, 185, 129, 0.2); color: var(--emerald-glow); border: 1px solid var(--emerald-glow); }
.status-indicator-badge.warning { background: rgba(245, 158, 11, 0.2); color: var(--amber-glow); border: 1px solid var(--amber-glow); }
.status-indicator-badge.danger { background: rgba(239, 68, 68, 0.2); color: var(--ruby-glow); border: 1px solid var(--ruby-glow); }

.part-info-banner {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--cyan-glow);
    font-weight: 700;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.findings-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.findings-lbl { font-size: 0.85rem; color: #fbbf24; }

#findings-list {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#findings-list li {
    font-size: 0.85rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--cyan-glow);
}

.action-guidelines-box {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 14px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guideline-title { font-size: 0.85rem; color: var(--cyan-glow); }
.guideline-content p { font-size: 0.82rem; color: #e2e8f0; margin-bottom: 4px; }

/* MENTAL HEALTH LAYOUT */
.mental-main-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .mental-main-layout { grid-template-columns: 1fr; }
}

.mental-interactive-panel {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 20px;
}

.mental-score-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.mental-score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 6px solid var(--emerald-glow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.m-score-val { font-size: 1.8rem; font-weight: 900; color: #fff; }
.m-score-lbl { font-size: 0.75rem; color: var(--emerald-glow); font-weight: 700; }

.mental-breakdown-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.m-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.ai-counselor-box {
    width: 100%;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* FAST STROKE ALERT */
.fast-intro-card {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 16px;
    border-radius: 12px;
}

.fast-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.fast-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.fast-card.danger {
    border-color: var(--ruby-glow);
    background: rgba(239, 68, 68, 0.1);
}

.fast-letter {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--cyan-glow);
}

.btn-fast-check {
    padding: 10px;
    background: rgba(6, 182, 212, 0.2);
    color: var(--cyan-glow);
    border: 1px solid var(--cyan-glow);
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.btn-fast-sos {
    padding: 10px;
    background: var(--ruby-glow);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* rPPG METRICS */
.rppg-main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) { .rppg-main-layout { grid-template-columns: 1fr; } }

.rppg-viewport-box {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rppg-wave-overlay {
    position: absolute;
    bottom: 60px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    padding: 6px;
}

#pulse-wave-canvas { width: 100%; height: 60px; }

.btn-rppg-start {
    padding: 14px;
    background: var(--emerald-glow);
    color: #000;
    font-weight: 900;
    border-radius: 10px;
    border: none;
    cursor: pointer;
}

.rppg-metrics-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-row {
    display: flex;
    gap: 10px;
}

.m-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    padding: 14px;
    border-radius: 10px;
    text-align: center;
}

.m-icon { font-size: 1.5rem; display: block; }
.m-val { font-size: 1.6rem; font-weight: 900; color: var(--cyan-glow); display: block; }
.m-unit { font-size: 0.7rem; color: var(--text-muted); }

/* HEALTH VAULT REPORT */
.vault-main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

@media (max-width: 900px) { .vault-main-layout { grid-template-columns: 1fr; } }

.clinical-report-paper {
    background: #ffffff;
    color: #0f172a;
    padding: 30px;
    border-radius: 14px;
    font-family: 'Noto Sans KR', sans-serif;
}

.report-paper-hdr {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.report-paper-hdr h2 { font-size: 1.3rem; color: #0f172a; }
.report-paper-hdr p { font-size: 0.8rem; color: #64748b; }

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
}

.report-table th, .report-table td {
    border: 1px solid #cbd5e1;
    padding: 8px;
    text-align: left;
}

.report-table th { background: #f1f5f9; }

.tag { padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.75rem; }
.tag-normal { background: #dcfce7; color: #166534; }

.report-mental-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.85rem;
}

.vault-actions-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-vault {
    padding: 14px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    border: none;
}

.btn-vault.print { background: #3b82f6; color: #fff; }
.btn-vault.sos { background: #ef4444; color: #fff; box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }

/* MODALS */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.overlay.active { display: flex; }

.modal-box {
    background: #0f172a;
    border: 1px solid var(--cyan-glow);
    padding: 24px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-hdr { display: flex; justify-content: space-between; align-items: center; }
.btn-close { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
.btn-primary-full { padding: 12px; background: var(--cyan-glow); color: #000; font-weight: 900; border: none; border-radius: 10px; cursor: pointer; }

/* 🏥 HOSPITAL & PHARMACY FINDER STYLES (v2.0.0) */
.facility-finder-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.facilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.facility-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.facility-card:hover {
    border-color: var(--cyan-glow);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.25);
}

.facility-card.er-highlight {
    border-color: var(--ruby-glow);
    background: rgba(239, 68, 68, 0.08);
}

.f-hdr {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.f-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.f-status-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 900;
}

.f-status-badge.open { background: rgba(16, 185, 129, 0.2); color: var(--emerald-glow); border: 1px solid var(--emerald-glow); }
.f-status-badge.closed { background: rgba(239, 68, 68, 0.2); color: var(--ruby-glow); border: 1px solid var(--ruby-glow); }
.f-status-badge.er24 { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #fbbf24; }

.f-info-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.83rem;
    color: #cbd5e1;
}

.f-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn-f-call {
    flex: 1;
    padding: 10px;
    background: #3b82f6;
    color: #fff;
    font-weight: 800;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
}

.btn-f-map {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--cyan-glow);
    border: 1px solid var(--cyan-glow);
    font-weight: 800;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
}

/* 🔬 SCAN COMPLETE & COUNTDOWN STYLES (v2.2.0) */
.scan-overlay-reticle.scanning {
    border-color: #f59e0b !important;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
}

.scan-overlay-reticle.completed {
    border-color: #10b981 !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
}

.scan-overlay-reticle.completed .target-corner {
    border-color: #10b981 !important;
}

.scan-overlay-reticle.completed .scan-laser-line {
    display: none !important;
}

/* 🎨 CAMERA COLOR MODE FILTERS (v3.0.0) */
#camera-feed.filter-original { filter: none; }
#camera-feed.filter-vascular { filter: saturate(250%) hue-rotate(-20deg) contrast(140%); }
#camera-feed.filter-mono { filter: grayscale(100%) contrast(180%); }
#camera-feed.filter-thermal { filter: invert(80%) hue-rotate(180deg) saturate(300%); }
