:root {
    /* Color Palette - Medical Professional (Light Mode) */
    --bg-primary: #F8FAFC;
    /* Light Slate Background */
    --bg-secondary: #FFFFFF;
    /* White Cards */
    --bg-tertiary: #F1F5F9;
    /* Input/Hover Background */
    --accent-primary: #0EA5E9;
    /* Sky Blue (Medical Blue) */
    --accent-success: #10B981;
    /* Emerald Green */
    --accent-danger: #EF4444;
    /* Red Danger */
    --text-primary: #0F172A;
    /* Slate 900 */
    --text-secondary: #64748B;
    /* Slate 500 */
    --text-muted: #94A3B8;
    /* Slate 400 */
    --border-color: #E2E8F0;
    /* Slate 200 */

    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 0 transparent;
    /* No glow in medical theme */

    /* Layout */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    /* Clean background, no gradient or subtle pattern */
    background-image: none;
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    /* Add Header border */
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--accent-success);
    background: #ECFDF5;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #D1FAE5;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
}

/* Upload Section (Hero) */
.upload-section {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.hero-content {
    margin-bottom: 3rem;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.upload-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    transition: all 0.2s ease;
    background: #FAFAFA;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: #F0F9FF;
}

.upload-icon-container {
    width: 64px;
    height: 64px;
    background: #E0F2FE;
    /* Light Blue */
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.upload-icon {
    width: 32px;
    height: 32px;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.required-files {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.file-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    /* Slightly sharper */
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2);
}

.btn-primary:hover {
    background: #0284C7;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-success);
    color: white;
    width: 100%;
    margin-top: 1.5rem;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
}

.btn-success:disabled {
    opacity: 0.6;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
    border-color: #CBD5E1;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.remove-btn:hover {
    color: var(--accent-danger);
}

/* Results Section (Bento Grid) */
.results-section {
    width: 100%;
    padding-bottom: 4rem;
    animation: slideUp 0.6s ease-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(280px, auto);
    gap: 1.5rem;
}

.bento-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.bento-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #CBD5E1;
}

.span-col-2 {
    grid-column: span 2;
}

.span-col-4 {
    grid-column: span 4;
}

.span-row-2 {
    grid-row: span 2;
}

.highlight-card {
    background: white;
    border-left: 4px solid var(--accent-primary);
    /* Accent border for status */
}

.card-header {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--bg-tertiary);
    padding-bottom: 0.75rem;
}

.card-header h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.95rem;
    flex: 1;
    overflow-y: auto;
}

.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bg-tertiary);
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.feature-item .value {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.chart-container {
    flex: 1;
    background: #FBFCFD;
    /* Very light background for charts */
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    border: 1px solid var(--border-color);
}

.chart-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chart-container:hover img {
    transform: scale(1.02);
}

/* Prediction Card Special Style */
.prediction-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.status-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 4px solid transparent;
}

.status-icon.normal {
    background: #ECFDF5;
    color: var(--accent-success);
    border-color: #D1FAE5;
}

.status-icon.abnormal {
    background: #FEF2F2;
    color: var(--accent-danger);
    border-color: #FECACA;
}

.status-info {
    text-align: left;
}

.status-label {
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.status-result {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.status-result.normal {
    color: var(--accent-success);
}

.status-result.abnormal {
    color: var(--accent-danger);
}

.status-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Model Grid */
.model-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

/* Loading Overlay */
.loading-overlay {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E0F2FE;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
/* Responsive */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .span-col-4 {
        grid-column: span 2;
    }
}

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

    .status-result {
        font-size: 2rem;
        word-break: break-word;
    }

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

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

    .span-col-2,
    .span-col-4 {
        grid-column: span 1;
    }

    .span-row-2 {
        grid-row: span 1;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

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

    .status-info {
        text-align: center;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .results-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .results-actions .btn {
        flex: 1;
    }
}

/* RAG & Chart Fixes */
.rag-content {
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 1.5rem !important;
}

.chart-container {
    min-height: 300px !important;
    padding: 1rem !important;
}

.chart-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}