/* ==========================================================================
   CORTEXMED AI - MODERN HEALTHCARE AESTHETIC (LIGHT GLASS / COBALT)
   Inspired by contemporary high-end medical platforms & digital health UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-page: #edf2f8;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-solid: #ffffff;
    --bg-dark-pill: #0f172a;
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --accent-teal: #0d9488;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --card-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.05), 0 4px 12px -2px rgba(15, 23, 42, 0.03);
    --card-shadow-hover: 0 20px 40px -10px rgba(37, 99, 235, 0.1), 0 8px 16px -3px rgba(15, 23, 42, 0.04);
    --card-border: rgba(226, 232, 240, 0.8);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0;
    padding: 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: none;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.07) 0%, transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(147, 197, 253, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 50% 85%, rgba(13, 148, 136, 0.06) 0%, transparent 45%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Force all containers to stay within viewport - ZERO SIDEWAYS WOBBLE */
main, section, header, nav, footer, .tab-content, .med-card {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure long text, terms, tables never break layout width */
p, span, div, h1, h2, h3, h4, h5, h6, a, li {
    overflow-wrap: break-word;
    word-break: break-word;
}

img, svg, video, canvas, audio, iframe, pre, code {
    max-width: 100%;
}

pre, code {
    white-space: pre-wrap;
    word-break: break-all;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #e2e8f0;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile-First App Polish & Bottom Dock */
.mobile-dock-btn {
    position: relative;
    color: #64748b;
    transition: all 0.2s ease;
    touch-action: manipulation;
}
.mobile-dock-btn.active {
    color: #2563eb;
}
.mobile-dock-btn.active i {
    transform: scale(1.18);
    color: #2563eb;
}
.mobile-dock-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    width: 14px;
    height: 3px;
    background: #2563eb;
    border-radius: 9999px;
}

/* Prevent auto-zoom on iOS Safari */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Card Styling */
.med-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.med-card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(37, 99, 235, 0.3);
}

.med-card-solid {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 28px;
    box-shadow: var(--card-shadow);
}

/* Navigation Tabs (Pill style matching the mockup) */
.nav-pill {
    color: #475569;
    background: transparent;
    border-radius: 9999px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.nav-pill:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}
.nav-pill.active {
    color: #ffffff;
    background: #0f172a;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
}

/* Page Transition Animation for True Web App Experience */
@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.block {
    animation: fadeInPage 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Clinical Badge */
.health-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 12px;
    border-radius: 9999px;
}

/* Vital Signs Tiles in Bedside HUD */
.vital-tile-light {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 12px 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.vital-tile-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}
.vital-tile-light.bp::before { background: #0284c7; }
.vital-tile-light.hr::before { background: #10b981; }
.vital-tile-light.rr::before { background: #6366f1; }
.vital-tile-light.spo2::before { background: #0ea5e9; }
.vital-tile-light.temp::before { background: #f59e0b; }

/* 3D Flashcard Flip in Light Mode */
.perspective-container {
    perspective: 1200px;
}

.flashcard-3d-light {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    transform-style: preserve-3d;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 32px;
    box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.08);
}

.flashcard-3d-light:hover {
    box-shadow: 0 25px 45px -10px rgba(37, 99, 235, 0.15);
}

/* Audio Scrubber */
input[type=range]#podcastScrubber {
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    outline: none;
    border-radius: 9999px;
    height: 6px;
    transition: all 0.2s;
}
input[type=range]#podcastScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
    transition: transform 0.15s ease, background-color 0.15s;
}
input[type=range]#podcastScrubber::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: #1d4ed8;
}

/* Active Speaker Line in Podcast */
.speaker-active-light {
    border-color: #2563eb !important;
    background: #eff6ff !important;
    box-shadow: 0 4px 15px -2px rgba(37, 99, 235, 0.12);
}

/* Quiz Option in Light Mode */
.quiz-option-light {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.quiz-option-light:hover {
    border-color: #2563eb;
    background: #f8fafc;
    transform: translateX(3px);
}
.quiz-option-light.selected-correct {
    border-color: #10b981 !important;
    background: #ecfdf5 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
.quiz-option-light.selected-wrong {
    border-color: #f43f5e !important;
    background: #fff1f2 !important;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.15);
}

/* Heartbeat pulse animation */
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.15); }
    28% { transform: scale(1); }
    42% { transform: scale(1.12); }
    70% { transform: scale(1); }
}
.heart-pulse {
    animation: heartBeat 1.4s ease-in-out infinite;
}
