/* 
    Brain Tumor Detection - Glassmorphism UI 
    Theme: Modern Dark Mode Dashboard 
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;700;800&display=swap');

:root {
    /* Colors - Dark Theme base */
    --bg-dark: #0f172a;
    /* slate-900 */
    --bg-darker: #0a0f1a;
    /* darker slate */
    --panel-bg: rgba(30, 41, 59, 0.7);
    /* slate-800 semi-transparent */
    --panel-border: rgba(255, 255, 255, 0.12);

    /* Accents */
    --accent-primary: #38bdf8;
    /* sky-400 */
    --accent-glow: rgba(56, 189, 248, 0.5);

    /* Status Colors */
    --danger: #ef4444;
    /* red-500 */
    --danger-glow: rgba(239, 68, 68, 0.4);
    --success: #10b981;
    /* emerald-500 */
    --success-glow: rgba(16, 185, 129, 0.4);
    --warning: #f59e0b;
    /* amber-500 */

    /* Text */
    --text-main: #f8fafc;
    /* slate-50 */
    --text-muted: #94a3b8;
    /* slate-400 */

    /* Typography */
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    /* Styling */
    --radius-lg: 20px;
    --radius-md: 12px;
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-theme: all 1s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #0a0f1a 0%, #0f172a 50%, #1e1b4b 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: var(--transition-theme);
}

/* --- Atmospheric Background Effects --- */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.glow-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
}

.glow-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    /* purple-500 */
    animation-delay: -5s;
}

.glow-3 {
    top: 40%;
    left: 40%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {

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

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

/* --- Layout --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
    /* Ensure content sits above the 3D canvas */
    position: relative;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through to Vanta if not on a panel */
}

/* Glassmorphism Utility with 3D Support */
.glass-panel {
    background: rgba(30, 41, 59, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;

    /* 3D Transform setup for vanilla-tilt */
    transform-style: preserve-3d;
    transition: box-shadow 0.3s ease;
    pointer-events: auto;
    /* Re-enable pointer events for panels */
}

.glass-panel:hover {
    box-shadow: 0 30px 60px -15px rgba(56, 189, 248, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

/* Apply 3D pop-out to inner elements of panels */
.glass-panel>* {
    transform: translateZ(30px);
}

.glass-panel .section-header {
    transform: translateZ(40px);
}

/* --- Header --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-icon-container {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.05));
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success-glow);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* --- Main Content Grid --- */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    flex-grow: 1;
    transform: translateZ(20px);
}

section {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e2e8f0;
}

.section-header i {
    color: var(--accent-primary);
}

/* --- Left Column: Upload & Preview --- */
.upload-area {
    border: 2px dashed rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.4));
    transition: var(--transition-smooth);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.05);
}

.upload-area::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 0 rgba(56, 189, 248, 0);
    transition: var(--transition-smooth);
    border-radius: var(--radius-lg);
}

.upload-area:hover::after,
.upload-area.dragover::after {
    box-shadow: inset 0 0 30px rgba(56, 189, 248, 0.1);
}

.upload-content {
    text-align: center;
    z-index: 10;
}

.upload-icon-wrapper {
    width: 80px;
    height: 80px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    border: 1px solid var(--panel-border);
    transition: transform 0.3s;
}

.upload-area:hover .upload-icon-wrapper {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.upload-icon {
    font-size: 32px;
    color: var(--accent-primary);
}

.primary-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.secondary-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.upload-link {
    color: var(--accent-primary);
    cursor: pointer;
    font-weight: 500;
    margin-left: 0.25rem;
}

.upload-link:hover {
    text-decoration: underline;
}

.file-types {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.badge {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.image-container {
    background: #000;
    border-radius: var(--radius-lg);
    border: 1px solid var(--panel-border);
    overflow: hidden;
    position: relative;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: filter 0.5s ease;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-details i {
    color: var(--accent-primary);
    font-size: 1.25rem;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
    color: #cbd5e1;
}

/* Animations Triggered by Classes */
.fade-in {
    animation: fadeIn 0.5s;
}

.slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

/* --- Scanner Effect --- */
.scanner-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(0, 0, 0, 0.3);
    /* slightly dim the image */
}

.image-container.scanning img {
    filter: brightness(0.7) contrast(1.2);
}

.image-container.scanning .scanner-overlay {
    opacity: 1;
}

.scanner-line {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-primary), 0 0 30px var(--accent-primary);
    animation: scanLine 2.5s ease-in-out infinite alternate;
    transform-style: preserve-3d;
    transform: perspective(500px) rotateX(20deg);
}

.scanner-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--accent-glow), transparent);
}

@keyframes scanLine {
    0% {
        top: 5%;
    }

    100% {
        top: 95%;
    }
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    /* sky-500 to sky-600 */
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(2, 132, 199, 0.4);
}

.primary-btn:hover::before {
    opacity: 1;
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #475569;
    /* slate-600 */
}

/* Button Group */
.button-group {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.button-group .primary-btn {
    flex: 1;
}

/* Secondary Button (Reset) */
.secondary-btn {
    background: rgba(71, 85, 105, 0.5);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 1rem 1.25rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.secondary-btn:hover {
    background: rgba(71, 85, 105, 0.8);
    border-color: rgba(148, 163, 184, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.secondary-btn i {
    font-size: 0.9rem;
}

/* Pulsing effect for analyze button when ready */
.pulse-btn:not(:disabled) {
    animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(2, 132, 199, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
    }
}

/* --- Right Column: Results Area --- */
.results-section {
    height: 100%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    color: var(--text-muted);
    text-align: center;
    height: 400px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(148, 163, 184, 0.2);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: var(--accent-primary);
}

/* SVG Loader */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    height: 400px;
}

.loader-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.loader {
    width: 50px;
    height: 50px;
}

.loader svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.loader svg circle,
.loader svg polygon,
.loader svg rect {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw 2s linear infinite;
}

.loader.triangle svg polygon {
    stroke-dasharray: 250;
    stroke-dashoffset: 250;
    animation-delay: 0.2s;
    stroke: var(--success);
}

.loader:last-child svg rect {
    animation-delay: 0.4s;
    stroke: var(--danger);
}

@keyframes draw {
    50% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -200;
    }
}

.loading-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
}

.dots {
    display: inline-block;
    width: 20px;
    animation: dots 1.5s infinite steps(4, end);
    overflow: hidden;
    vertical-align: bottom;
}

@keyframes dots {
    0% {
        width: 0px;
    }

    100% {
        width: 20px;
    }
}

/* Results Content */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Primary Result Card */
.primary-result-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.primary-result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px 0 0 4px;
}

.primary-result-card.danger-state::before {
    background: var(--danger);
}

.primary-result-card.success-state::before {
    background: var(--success);
}

.diagnosis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.diagnosis-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.confidence-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.confidence-badge.high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.confidence-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.confidence-badge.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.diagnosis-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-ring {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: rgba(15, 23, 42, 0.8);
    position: relative;
}

.primary-result-card.danger-state .status-ring {
    color: var(--danger);
    box-shadow: 0 0 20px var(--danger-glow);
    border: 2px solid var(--danger);
}

.primary-result-card.success-state .status-ring {
    color: var(--success);
    box-shadow: 0 0 20px var(--success-glow);
    border: 2px solid var(--success);
}

.diagnosis-details h4 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.25rem;
    transform: translateZ(60px);
}

.gradient-text {
    background: linear-gradient(to right, #38bdf8, #a78bfa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.confidence-score {
    font-size: 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.score-value {
    font-family: monospace;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-main);
}

.score-symbol {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Secondary Data Cards */
.data-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.5));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--text-muted);
}

/* Probability Bars */
.prob-item {
    margin-bottom: 1rem;
}

.prob-item:last-child {
    margin-bottom: 0;
}

.prob-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.prob-name {
    font-weight: 500;
}

.prob-value {
    font-family: monospace;
    color: var(--text-muted);
}

.prob-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Info Grid internally generated from JS */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-group.full-width {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-weight: 500;
    font-size: 1rem;
}

.text-accent {
    color: var(--accent-primary);
}

.info-desc {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #cbd5e1;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.symptom-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #e2e8f0;
}

/* Recommendation */
.rec-alert {
    display: flex;
    gap: 1rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 1.25rem;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.rec-alert i {
    color: var(--accent-primary);
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

/* --- Footer --- */
.footer {
    padding: 1.5rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.warning-text {
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-text strong {
    color: #fcd34d;
}

.copyright {
    color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .logo h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

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

    .diagnosis-main {
        flex-direction: column;
        text-align: center;
    }
}

/* === FEATURE 1: Heatmap Canvas === */
#heatmapCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    border-radius: var(--radius-md);
}

/* View Toggle Bar */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.toggle-btn.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* === FEATURE 2: Medical Image Toolbar === */
.image-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    flex-wrap: wrap;
}

.tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 0.8rem;
}

.tool-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toolbar-slider-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toolbar-slider-group label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.toolbar-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.toolbar-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--accent-primary);
}

.image-container {
    overflow: hidden;
    cursor: default;
}

.image-container img {
    transition: transform 0.2s ease;
    transform-origin: center center;
}

/* === FEATURE 3: Chart + Bars Layout === */
.chart-and-bars {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

#polarChart {
    flex-shrink: 0;
}

.chart-and-bars .probability-bars {
    flex: 1;
    min-width: 0;
}

/* === FEATURE 4: 3D Brain Container === */
#brainModelContainer {
    width: 100%;
    height: 220px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

#brainModelContainer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* === FEATURE 5: Export Button === */
.export-btn {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--accent-primary);
    font-weight: 600;
    transition: var(--transition-smooth);
}

.export-btn:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(139, 92, 246, 0.25));
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
    transform: translateY(-1px);
}

/* Responsive adjustments for new features */
@media (max-width: 768px) {
    .chart-and-bars {
        flex-direction: column;
    }

    #polarChart {
        width: 180px !important;
        height: 180px !important;
        margin: 0 auto;
    }

    .image-toolbar {
        justify-content: center;
    }

    .toolbar-slider {
        width: 60px;
    }
}
/* Browser inference status; original Flask presentation is retained. */
.browser-model-status {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(56, 189, 248, 0.24);
    background: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
    font-size: 0.85rem;
    line-height: 1.55;
}
.browser-model-status strong { display: block; color: #7dd3fc; }
.browser-model-status p { margin: 7px 0 0; }
.browser-model-status .model-explanation { color: #94a3b8; font-size: 0.78rem; }
.browser-model-status progress { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: #38bdf8; }
.browser-model-status progress[hidden] { display: none; }
.browser-model-status[data-state="error"] { border-color: #f87171; }
.browser-model-status[data-state="error"] strong { color: #fca5a5; }
.browser-model-status[data-state="ready"] { border-color: rgba(16, 185, 129, 0.4); }
.browser-model-status[data-state="ready"] strong { color: #6ee7b7; }
