/* ═══════════════════════════════════════════════════════════════
   VITALIS AI — SPATIAL OCEAN-MINT DESIGN SYSTEM
   Layout: Floating panels, glassmorphism, gap-based spatial UI
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. DESIGN TOKENS ──────────────────────────────────────────── */
:root {
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Dark Theme Backgrounds */
    --bg-0: #000000;
    --bg-1: #0A1118;
    --bg-2: #14232C;
    --bg-3: #233D4D; /* Palette Slate/Blue */
    --bg-4: #2E5066;

    --bg-glass: rgba(35, 61, 77, 0.4);
    --bg-glass-h: rgba(35, 61, 77, 0.6);
    --bg-header: rgba(20, 35, 44, 0.85);
    --bg-drawer: rgba(20, 35, 44, 0.95);
    --bg-input: rgba(35, 61, 77, 0.3);

    /* Accents: Orange from Palette */
    --violet: #FE7F2D; /* Primary Accent */
    --violet-l: #FFA566;
    --violet-dim: rgba(254, 127, 45, 0.15);
    --violet-glow: rgba(254, 127, 45, 0.35);

    --cyan: #E86A1C;
    --cyan-l: #FE7F2D;
    --cyan-dim: rgba(232, 106, 28, 0.15);

    --emerald: #FE7F2D;
    --emerald-dim: rgba(254, 127, 45, 0.12);

    --amber: #FEE440;
    --amber-dim: rgba(254, 228, 64, 0.12);

    --rose: #F15BB5;
    --rose-dim: rgba(241, 91, 181, 0.12);

    /* Text: Light Grayish Blue from Palette */
    --text-0: #FFFFFF;
    --text-1: #EAECF0; /* Palette */
    --text-2: rgba(234, 236, 240, 0.7);
    --text-3: rgba(234, 236, 240, 0.4);

    /* Borders */
    --b-0: rgba(255, 255, 255, 0.05);
    --b-1: rgba(255, 255, 255, 0.09);
    --b-v: rgba(254, 127, 45, 0.4);
    --b-c: rgba(254, 127, 45, 0.3);

    /* Shadows */
    --s-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
    --s-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --s-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
    --s-xl: 0 24px 80px rgba(0, 0, 0, 0.8);
    --s-v: 0 0 30px rgba(254, 127, 45, 0.15), 0 0 60px rgba(254, 127, 45, 0.05);
    --s-in: inset 0 1px 0 rgba(255, 255, 255, 0.08);

    /* Gradients */
    --g-primary: linear-gradient(135deg, #FE7F2D, #FFA566);
    --g-violet: linear-gradient(135deg, #FE7F2D, #FFA566);
    --g-text: linear-gradient(135deg, #FFFFFF 0%, #FFA566 50%, #FE7F2D 100%);

    /* Message bubbles */
    --bot-bg: rgba(35, 61, 77, 0.85);
    --usr-bg: linear-gradient(135deg, #FE7F2D, #E86A1C);

    /* Layout */
    --header-h: 64px;
    --drawer-w: 300px;
    --panel-w: 300px;
    --app-gap: 16px;
    --app-pad: 16px;

    /* Easing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Radii */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-xl: 32px;
    --r-full: 9999px;
}

/* ── 2. LIGHT THEME ─────────────────────────────────────────────── */
body.light-theme {
    --bg-0: #F1F5F9;
    --bg-1: #E2E8F0;
    --bg-2: #FFFFFF;
    --bg-3: #F8FAFC;
    --bg-4: #CBD5E1;

    --bg-glass: rgba(255, 255, 255, 0.95);
    --bg-glass-h: rgba(255, 255, 255, 1);
    --bg-header: rgba(255, 255, 255, 0.98);
    --bg-drawer: rgba(255, 255, 255, 0.98);
    --bg-input: rgba(255, 255, 255, 0.95);

    --violet: #059669;
    /* Darker Mint/Green for legibility */
    --violet-l: #10B981;
    --violet-dim: rgba(16, 185, 129, 0.1);
    --violet-glow: rgba(16, 185, 129, 0.2);

    --cyan: #0284C7;
    --cyan-l: #0EA5E9;
    --cyan-dim: rgba(14, 165, 233, 0.1);

    --emerald: #059669;
    --amber: #D97706;
    --rose: #E11D48;
    --rose-dim: rgba(225, 29, 72, 0.08);

    --text-0: #0F172A;
    --text-1: rgba(15, 23, 42, 0.8);
    --text-2: rgba(15, 23, 42, 0.6);
    --text-3: rgba(15, 23, 42, 0.4);

    --b-0: rgba(0, 0, 0, 0.06);
    --b-1: rgba(0, 0, 0, 0.09);
    --b-v: rgba(16, 185, 129, 0.25);
    --b-c: rgba(14, 165, 233, 0.25);

    --s-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --s-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --s-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
    --s-xl: 0 24px 60px rgba(0, 0, 0, 0.15);
    --s-v: 0 0 24px rgba(16, 185, 129, 0.2);
    --s-in: inset 0 1px 0 rgba(255, 255, 255, 0.9);

    --g-primary: linear-gradient(135deg, #0EA5E9, #10B981);
    --g-text: linear-gradient(135deg, #0F172A 0%, #059669 60%, #0284C7 100%);

    --bot-bg: rgba(255, 255, 255, 0.95);
    --usr-bg: linear-gradient(135deg, #0EA5E9, #0284C7);

    background: #F8FAFC; /* Softer, cooler light gray */
}

body.light-theme .chat-main,
body.light-theme .left-sidebar,
body.light-theme .right-panel,
body.light-theme .card,
body.light-theme .modal-content {
    background: #FFFFFF !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.light-theme .grid-lines, 
body.light-theme .bg-mesh {
    display: none; /* Hide squarish design and old mesh */
}

body.light-theme::before {
    background: radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.08), transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(241, 91, 181, 0.04), transparent 60%);
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

body.light-theme .bg-mesh {
    display: none;
}

body.light-theme .orb {
    display: none;
}

body.light-theme .grid-lines {
    background-image: linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

body.light-theme .vignette {
    box-shadow: none;
}

body.light-theme .float-item {
    opacity: 0.03;
    color: var(--violet);
}

/* ── 3. RESET & BASE ─────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-0);
    display: flex;
    flex-direction: column;
    color: var(--text-0);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
.stat-value {
    font-family: var(--font-heading);
}

/* Noise texture */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 9999;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 80% 80% at 15% 20%, rgba(0, 187, 249, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 70% 70% at 85% 80%, rgba(0, 245, 212, 0.12) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

.no-transition * {
    transition: none !important;
}

/* ── 4. ANIMATED BACKGROUND ─────────────────────────────────────── */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.vignette {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 150px rgba(4, 9, 20, 0.9);
    z-index: 5;
}

.cellular-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: radial-gradient(var(--violet) 1px, transparent 1px), radial-gradient(var(--cyan) 1px, transparent 1px);
    background-size: 48px 48px;
    background-position: 0 0, 24px 24px;
}

.grid-lines {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 64px 64px;
}

.bg-mesh {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 90% 70% at 20% 60%, rgba(0, 187, 249, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 70% 60% at 80% 30%, rgba(0, 245, 212, 0.08) 0%, transparent 55%);
    animation: meshDrift 30s ease-in-out infinite alternate;
}

@keyframes meshDrift {
    0% {
        transform: scale(1) rotate(0)
    }

    100% {
        transform: scale(1.05) rotate(2deg)
    }
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    animation: orbDrift var(--dur, 22s) ease-in-out infinite alternate;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: rgba(0, 187, 249, 0.15);
    top: -100px;
    left: -100px;
    --dur: 28s;
}

.orb-2 {
    width: 700px;
    height: 700px;
    background: rgba(0, 245, 212, 0.12);
    bottom: -200px;
    right: -200px;
    --dur: 32s;
    animation-direction: alternate-reverse;
}

.orb-3 {
    width: 500px;
    height: 500px;
    background: rgba(0, 187, 249, 0.08);
    top: 40%;
    left: 30%;
    --dur: 20s;
}

@keyframes orbDrift {
    0% {
        transform: translate(0, 0) scale(1)
    }

    100% {
        transform: translate(40px, -30px) scale(1.1)
    }
}

.floating-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.float-item {
    position: absolute;
    color: var(--violet);
    opacity: 0.06;
    font-size: 4rem;
    animation: floatDrift 16s infinite ease-in-out alternate;
}

@keyframes floatDrift {
    0% {
        transform: translateY(0) rotate(0) scale(1)
    }

    100% {
        transform: translateY(-30px) rotate(8deg) scale(1.05)
    }
}

/* ── 5. LOGIN SCREEN ────────────────────────────────────────────── */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-0);
    transition: opacity 0.6s var(--ease-smooth);
}

.login-box {
    position: relative;
    z-index: 2;
    background: rgba(10, 17, 40, 0.85);
    border: 1px solid var(--b-v);
    padding: 50px 45px;
    border-radius: var(--r-xl);
    text-align: center;
    box-shadow: var(--s-xl), var(--s-v);
    max-width: 420px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
}

.login-logo-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--violet-dim);
    border: 1px solid var(--b-v);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 0 30px rgba(0, 245, 212, 0.3);
    animation: logoPulse 2.5s ease-in-out infinite alternate;
}

.login-logo {
    font-size: 2.2rem;
    color: var(--violet-l);
    filter: drop-shadow(0 0 10px rgba(0, 245, 212, 0.6));
}

@keyframes logoPulse {
    from {
        box-shadow: 0 0 20px rgba(0, 245, 212, 0.2);
        transform: scale(1)
    }

    to {
        box-shadow: 0 0 40px rgba(0, 245, 212, 0.5);
        transform: scale(1.05)
    }
}

.login-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    background: var(--g-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.login-subtitle {
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--r-md);
    background: #fff;
    color: #0F172A;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.login-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.login-btn:active {
    transform: scale(0.97);
}

body.light-theme .login-box {
    background: rgba(255, 255, 255, 0.95);
}

/* ── 6. SPATIAL APP WRAPPER ──────────────────────────────────── */
.app-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    padding: var(--app-pad);
    gap: var(--app-gap);
    opacity: 0;
    pointer-events: none;
}

.app-wrapper.loaded {
    animation: wrapperIn 0.8s var(--ease-smooth) forwards;
    pointer-events: auto;
}

@keyframes wrapperIn {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ── 7. FLOATING TOP HEADER ──────────────────────────────────── */
.app-header {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-header);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--b-1);
    border-radius: var(--r-lg);
    box-shadow: var(--s-md), var(--s-in);
    position: relative;
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--b-0);
    color: var(--text-1);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
    flex-shrink: 0;
}

.menu-btn:hover {
    background: var(--violet-dim);
    border-color: var(--b-v);
    color: var(--violet-l);
    transform: scale(1.05);
}

.brand-logo-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 4px solid #EBF4FA;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.15);
    position: relative;
}

.brand-pulse {
    font-size: 1.1rem;
    color: #3182CE;
    animation: heartbeat 1.8s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1)
    }

    15% {
        transform: scale(1.15)
    }

    30% {
        transform: scale(0.95)
    }

    45% {
        transform: scale(1.1)
    }
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--g-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.02em;
    line-height: 1;
}

.status {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    color: var(--emerald);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--emerald);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--emerald);
    animation: statusBlink 2s infinite;
}

@keyframes statusBlink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.4
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-select {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-1);
    border: 1px solid var(--b-0);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    height: 40px;
    transition: all 0.2s;
}

.lang-select:hover {
    border-color: var(--b-v);
    background: var(--violet-dim);
}

.lang-select option {
    background: #0A1128;
    color: var(--text-0);
}

body.light-theme .lang-select option {
    background: #FFFFFF;
    color: #0F172A;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--b-0);
    color: var(--text-2);
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
}

.icon-btn:hover {
    color: var(--text-0);
    border-color: var(--b-v);
    background: var(--violet-dim);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 245, 212, 0.2);
}

.icon-btn:active {
    transform: scale(0.92);
}

#theme-toggle:hover {
    color: var(--amber) !important;
    border-color: rgba(254, 228, 64, 0.3) !important;
    background: var(--amber-dim) !important;
}

#download-pdf:hover {
    color: var(--cyan-l) !important;
    border-color: var(--b-c) !important;
    background: var(--cyan-dim) !important;
}

#clear-chat:hover {
    color: var(--rose) !important;
    border-color: rgba(241, 91, 181, 0.3) !important;
    background: var(--rose-dim) !important;
}

.info-panel-btn:hover {
    color: var(--violet-l) !important;
    border-color: var(--b-v) !important;
    background: var(--violet-dim) !important;
}

/* ── 8. APP BODY (FLEX) ──────────────────────────────────────── */
.app-body {
    flex: 1;
    display: flex;
    gap: var(--app-gap);
    min-height: 0;
    position: relative;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 9, 20, 0.8);
    backdrop-filter: blur(12px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease-out);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ── 9. SPATIAL LEFT DRAWER ──────────────────────────────────── */
.left-sidebar {
    width: var(--drawer-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-drawer);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--b-1);
    border-radius: var(--r-xl);
    box-shadow: var(--s-lg), var(--s-in);
    z-index: 100;
    overflow: hidden;
}

/* On Desktop, sidebar is normally visible. But wait, in command center it was an overlay. Let's make it a flex item but hidden until toggled if user prefers, OR static if space permits. Actually, we'll keep it as fixed overlay on left to save chat space, matching the "floating drawer" vibe. */
.left-sidebar {
    position: fixed;
    top: calc(var(--app-pad) + var(--header-h) + var(--app-gap));
    left: var(--app-pad);
    height: calc(100vh - var(--header-h) - (var(--app-pad)*2) - var(--app-gap));
    transform: translateX(calc(-100% - 40px));
    transition: transform 0.4s var(--ease-spring);
}

.left-sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--b-0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h3 i {
    color: var(--violet);
    font-size: 0.9rem;
}

.close-sidebar-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--rose-dim);
    border: 1px solid rgba(241, 91, 181, 0.25);
    color: var(--rose);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-sidebar-btn:hover {
    background: rgba(241, 91, 181, 0.2);
    transform: scale(1.05);
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.new-chat-btn {
    width: 100%;
    padding: 14px;
    border-radius: var(--r-lg);
    background: var(--g-primary);
    border: none;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 245, 212, 0.4);
    transition: all 0.3s var(--ease-spring);
    flex-shrink: 0;
}

.new-chat-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 245, 212, 0.5);
}

.new-chat-btn:active {
    transform: scale(0.97);
}

/* ── 10. SPATIAL CARDS ───────────────────────────────────────── */
.card {
    background: var(--bg-glass);
    border: 1px solid var(--b-0);
    border-radius: var(--r-lg);
    padding: 20px;
    transition: all 0.3s var(--ease-spring);
    flex-shrink: 0;
    box-shadow: var(--s-sm);
}

.card:hover {
    border-color: var(--b-v);
    background: var(--bg-glass-h);
    transform: translateY(-3px);
    box-shadow: var(--s-md);
}

.card h4 {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h4 i {
    color: var(--violet);
    font-size: 0.9rem;
}

.text-sm {
    font-size: 0.85rem;
    color: var(--text-1);
    line-height: 1.6;
}

.emergency-card {
    border-color: rgba(241, 91, 181, 0.2) !important;
    background: rgba(241, 91, 181, 0.05) !important;
}

.emergency-card h4,
.emergency-card h4 i {
    color: var(--rose) !important;
}

/* History Sessions */
.history-section {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.session-item {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--b-0);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-2);
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-item:hover {
    background: var(--violet-dim);
    border-color: var(--b-v);
    color: var(--text-0);
    transform: translateX(4px);
}

.session-item.active {
    background: rgba(0, 245, 212, 0.15);
    border-color: var(--violet);
    color: var(--violet-l);
    font-weight: 500;
}

.session-title {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-date {
    font-size: 0.7rem;
    color: var(--text-3);
}

.session-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 4px;
}

.session-item:hover .session-actions {
    opacity: 1;
}

.session-action-btn {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.session-action-btn:hover {
    color: var(--violet-l);
}

.session-action-btn.delete-btn:hover {
    color: var(--rose);
}

/* ── 11. SPATIAL CHAT MAIN ───────────────────────────────────── */
.chat-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--b-1);
    border-radius: var(--r-xl);
    box-shadow: var(--s-lg), var(--s-in);
    overflow: hidden;
    position: relative;
}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar,
.panel-content::-webkit-scrollbar,
.history-section::-webkit-scrollbar {
    display: none;
}

/* ── 12. EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 24px;
    padding: 40px 20px;
}

.empty-hero-icon {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: heroFloat 4s ease-in-out infinite alternate;
}

@keyframes heroFloat {
    0% {
        transform: translateY(0)
    }

    100% {
        transform: translateY(-12px)
    }
}

.empty-hero-icon i {
    font-size: 4.5rem;
    background: var(--g-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 30px rgba(0, 245, 212, 0.7));
}

.empty-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-0);
}

.brand-highlight {
    background: var(--g-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-subtitle {
    font-size: 1rem;
    color: var(--text-2);
    max-width: 500px;
    line-height: 1.6;
}

/* Prompt GRID */
.prompt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    width: 100%;
    max-width: 800px;
    margin-top: 10px;
}

.prompt-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border-radius: var(--r-lg);
    border: 1px solid var(--b-0);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-1);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s var(--ease-spring);
    box-shadow: var(--s-sm);
}

.prompt-card:hover {
    border-color: var(--b-v);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--s-md);
}

.prompt-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.prompt-card-icon.vi {
    background: var(--violet-dim);
    color: var(--violet-l);
}

.prompt-card-icon.cy {
    background: var(--cyan-dim);
    color: var(--cyan-l);
}

.prompt-card-icon.em {
    background: var(--emerald-dim);
    color: var(--emerald);
}

.prompt-card-icon.am {
    background: var(--amber-dim);
    color: var(--amber);
}

.prompt-card-icon.ro {
    background: var(--rose-dim);
    color: var(--rose);
}

.prompt-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prompt-card-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-0);
}

.prompt-card-desc {
    font-size: 0.8rem;
    color: var(--text-2);
}

.quick-prompt-btn:not(.prompt-card) {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--r-md);
    border: 1px solid var(--b-0);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-1);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.quick-prompt-btn:not(.prompt-card):hover {
    background: var(--violet-dim);
    border-color: var(--b-v);
    color: var(--text-0);
    transform: translateX(4px);
}

.quick-prompt-btn:not(.prompt-card) i {
    color: var(--violet);
}

/* ── 13. MESSAGES ─────────────────────────────────────────────── */
.message {
    max-width: 75%;
    padding: 16px 22px;
    border-radius: var(--r-xl);
    font-size: 0.95rem;
    line-height: 1.7;
    animation: msgIn 0.4s var(--ease-spring) forwards;
    box-shadow: var(--s-sm);
    word-wrap: break-word;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.bot-msg {
    background: var(--bot-bg);
    border: 1px solid var(--b-1);
    border-bottom-left-radius: 6px;
    color: var(--text-0);
    align-self: flex-start;
    backdrop-filter: blur(20px);
}

.bot-msg h3,
.bot-msg h4 {
    color: var(--violet-l);
    font-family: var(--font-heading);
    margin: 12px 0 6px;
}

.bot-msg strong {
    color: var(--cyan-l);
    font-weight: 600;
}

.bot-msg ul {
    padding-left: 24px;
    margin-bottom: 12px;
}

.user-msg {
    background: var(--usr-bg);
    color: #fff !important;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 187, 249, 0.4);
}

/* ── 14. CHAT INPUT ──────────────────────────────────────────── */
.chat-input-container {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 17, 40, 0.4);
    border-top: 1px solid var(--b-0);
}

body.light-theme .chat-input-container {
    background: #F8FAFC;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.input-tools {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--r-md);
    border: 1px solid var(--b-0);
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--text-2);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    color: var(--cyan-l);
    background: var(--cyan-dim);
    transform: translateY(-2px);
}

.input-field-wrap {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--b-1);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.input-field-wrap:focus-within {
    border-color: var(--violet);
    background: rgba(0, 245, 212, 0.05);
    box-shadow: 0 0 0 4px var(--violet-dim);
}

#user-input {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text-0);
    font-size: 0.95rem;
    font-family: var(--font-body);
    outline: none;
}

#user-input::placeholder {
    color: var(--text-2);
}

.send-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--r-lg);
    background: var(--g-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.4);
    transition: all 0.3s var(--ease-spring);
}

.send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(0, 245, 212, 0.6);
}

/* ── 15. RIGHT INFO PANEL ────────────────────────────────────── */
.right-panel {
    width: var(--panel-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-drawer);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--b-1);
    border-radius: var(--r-xl);
    box-shadow: var(--s-lg), var(--s-in);
}

/* By default right panel is fixed overlay below 1280px, visible on desktop */
@media (min-width:1281px) {
    .right-panel {
        position: relative;
    }
}

@media (max-width:1280px) {
    .right-panel {
        position: fixed;
        top: calc(var(--app-pad) + var(--header-h) + var(--app-gap));
        right: var(--app-pad);
        height: calc(100vh - var(--header-h) - (var(--app-pad)*2) - var(--app-gap));
        transform: translateX(calc(100% + 40px));
        transition: transform 0.4s var(--ease-spring);
        z-index: 100;
    }

    .right-panel.panel-open {
        transform: translateX(0);
    }
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid var(--b-0);
}

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 i {
    color: var(--cyan);
    font-size: 0.9rem;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-card {
    border-color: var(--b-v) !important;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--violet);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-info strong {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--text-0);
    font-weight: 600;
}

.profile-info span {
    font-size: 0.8rem;
    color: var(--text-2);
}

.bio-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--b-0);
}

.bio-stat:last-child {
    border: none;
    padding-bottom: 0;
}

.bio-stat-label {
    font-size: 0.85rem;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bio-stat-label i {
    color: var(--violet);
}

.bio-stat-value {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--cyan);
    font-size: 0.9rem;
}

.signout-btn {
    width: 100%;
    padding: 12px;
    border-radius: var(--r-md);
    background: var(--rose-dim);
    color: var(--rose);
    border: 1px solid rgba(241, 91, 181, 0.3);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.signout-btn:hover {
    background: rgba(241, 91, 181, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(241, 91, 181, 0.2);
}

/* Tip / Disclaimer cards */
.tip-card h4 i {
    color: var(--amber) !important;
}

.disclaimer-card h4 i {
    color: var(--rose) !important;
}

/* ── 16. TOAST & MODALS ──────────────────────────────────────── */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: rgba(18, 30, 56, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid var(--b-v);
    color: var(--violet-l);
    padding: 14px 28px;
    border-radius: var(--r-lg);
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 600;
    opacity: 0;
    transition: all 0.4s var(--ease-spring);
    z-index: 10000;
    box-shadow: var(--s-lg);
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 9, 20, 0.85);
    backdrop-filter: blur(16px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: rgba(10, 17, 40, 0.95);
    border: 1px solid var(--b-v);
    border-radius: var(--r-xl);
    padding: 40px;
    width: 90%;
    max-width: 440px;
    box-shadow: var(--s-xl);
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s var(--ease-spring);
    position: relative;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

/* Modal Internal Forms */
.modal-subtitle {
    margin-bottom: 24px;
    color: var(--text-2);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-2);
    margin-left: 4px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: var(--bg-input);
    border: 1px solid var(--b-1);
    color: var(--text-0);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all 0.3s var(--ease-spring);
    outline: none;
}

.form-input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px var(--violet-dim);
    background: var(--bg-glass-h);
}

body.light-theme .form-input {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    color: #0F172A;
}

body.light-theme .form-input:focus {
    background: #FFFFFF;
    border-color: #0EA5E9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

body.light-theme .modal-content h3 {
    color: #0F172A;
}

body.light-theme .form-group label,
body.light-theme .modal-subtitle {
    color: #64748B;
}

.modal-submit-btn {
    margin-top: 12px;
}

.modal-content h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--violet-l);
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.close-modal-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--b-0);
    color: var(--text-2);
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    color: var(--rose);
    background: var(--rose-dim);
    border-color: rgba(241, 91, 181, 0.3);
}

/* Body map */
.body-map-wrap {
    margin: 24px auto;
    width: 160px;
}

.human-body-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.body-part {
    fill: rgba(0, 245, 212, 0.1);
    stroke: rgba(0, 245, 212, 0.5);
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s;
}

.body-part:hover {
    fill: rgba(0, 245, 212, 0.4);
    stroke: var(--violet-l);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 16px var(--violet));
}

/* Pain slider */
.pain-slider-wrap {
    margin: 24px 0;
    text-align: center;
}

.pain-face {
    font-size: 4.5rem;
    margin-bottom: 16px;
    animation: faceFloat 2s infinite alternate;
}

.pain-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--g-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    margin-bottom: 16px;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, var(--violet), var(--rose));
    border-radius: 4px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 26px;
    width: 26px;
    border-radius: 50%;
    background: var(--g-violet);
    box-shadow: 0 0 16px rgba(0, 245, 212, 0.6);
    margin-top: -9px;
    cursor: pointer;
    border: 3px solid #fff;
    transition: transform 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.pain-scale-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-2);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 24px;
}

/* ── 17. RESPONSIVE MEDIA QUERIES ────────────────────────────── */
@media (max-width:900px) {
    .chat-messages {
        padding: 30px 24px;
    }

    .prompt-grid {
        grid-template-columns: 1fr 1fr;
    }

    .chat-input-container {
        padding: 16px 20px;
    }
}

@media (max-width:640px) {
    :root {
        --app-pad: 8px;
        --app-gap: 8px;
        --header-h: 56px;
    }

    .left-sidebar {
        width: 85%;
        max-width: 320px;
    }

    .right-panel {
        width: 85%;
        max-width: 320px;
    }

    .chat-messages {
        padding: 20px 16px;
        gap: 16px;
    }

    .message {
        max-width: 90%;
        padding: 14px 18px;
        font-size: 0.9rem;
    }

    .prompt-grid {
        grid-template-columns: 1fr;
        max-width: 340px;
    }

    .chat-input-container {
        padding: 12px 14px;
        gap: 8px;
    }

    .input-tools {
        padding: 4px;
    }

    .action-btn {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .send-btn {
        width: 46px;
        height: 46px;
        font-size: 1rem;
    }

    #user-input {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .empty-hero-icon {
        width: 70px;
        height: 70px;
    }

    .empty-hero-icon i {
        font-size: 2rem;
    }

    .empty-title {
        font-size: 1.6rem;
    }

    .lang-select {
        display: none;
    }
}

/* ── 16. TYPING INDICATOR ────────────────────────────────────── */
.typing-indicator {
    padding: 16px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    min-height: 24px;
}
.dna-loader {
    display: flex;
    gap: 6px;
    align-items: center;
}
.dna-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--violet-l);
    animation: typingPulse 1.4s infinite ease-in-out both;
}
.dna-loader span:nth-child(1) { animation-delay: -0.32s; }
.dna-loader span:nth-child(2) { animation-delay: -0.16s; background: var(--cyan-l); }
.dna-loader span:nth-child(3) { animation-delay: 0s; background: var(--violet-l); }
.dna-loader span:nth-child(4) { animation-delay: 0.16s; background: var(--cyan-l); }

@keyframes typingPulse {
    0%, 80%, 100% { transform: scale(0.3); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; box-shadow: 0 0 10px var(--violet-l); }
}

/* Suggestion Chips & Follow-ups Styling */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
    margin-bottom: 8px;
    align-items: center;
    justify-content: flex-start;
}

.chip-btn {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: var(--text-color);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.chip-btn::before {
    content: "💡";
    font-size: 0.85rem;
}

.chip-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.chip-btn:active {
    transform: translateY(0);
}

/* RAG Thinking & Triage Badges */
.vitalis-rag-thinking {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 10px;
    font-size: 0.82rem;
    color: var(--text-color);
}

.vitalis-triage-badge {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 10px;
    font-size: 0.82rem;
    color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}