/* Import Google Fonts - Professional Medical Sans-Serif */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Professional Hospital Color Palette */
    --color-primary: #0e4f8b;         /* Medical Navy Blue */
    --color-primary-light: #1a6bb5;   /* Medium Blue */
    --color-primary-dark: #0a3d6b;    /* Deep Navy */
    --color-secondary: #0d9488;       /* Medical Teal */
    --color-secondary-light: #14b8a6; /* Light Teal */
    --color-accent: #4a90b8;          /* Steel Blue */
    --color-background: #f8fafc;      /* Clinical White-Gray */
    --color-surface: #ffffff;          /* Pure White */
    --color-text: #1e293b;            /* Dark Slate */
    --color-text-muted: #64748b;      /* Muted Gray */
    --color-border: #e2e8f0;          /* Light Border */
    --color-success: #059669;         /* Medical Green */
    --color-success-light: #ecfdf5;   /* Light Green */
    --color-warning: #d97706;         /* Amber */
    --color-warning-light: #fffbeb;   /* Light Amber */
    --color-error: #dc2626;           /* Alert Red */
    --color-error-light: #fef2f2;     /* Light Red */

    /* Shadows - Clean and Subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* Header - Clean Hospital Nav */
.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1.35rem;
}

.logo-icon {
    font-size: 1.75rem;
}

/* Main content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Hero section */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

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

/* Disclaimer banner */
.disclaimer-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-warning-light);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #92400e;
}

.disclaimer-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

/* Upload section */
.upload-section {
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--color-surface);
}

.upload-zone:hover {
    border-color: var(--color-accent);
    background: #f0f9ff;
}

.upload-zone.dragover {
    border-color: var(--color-secondary);
    background: var(--color-success-light);
}

.upload-icon {
    color: var(--color-accent);
    margin-bottom: 1rem;
    font-size: 3rem;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.upload-subtext {
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.upload-formats {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Image preview */
.preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.preview-content img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--color-border);
}

.preview-filename {
    font-size: 0.95rem;
    color: var(--color-text);
    font-weight: 600;
}

.btn-clear {
    background: var(--color-error);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background var(--transition-fast);
}

.btn-clear:hover {
    background: #b91c1c;
}

.hidden {
    display: none !important;
}

/* Upload error */
.upload-error {
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    color: var(--color-error);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Buttons */
.btn-analyze {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
    margin: 1.25rem auto 0;
    padding: 0.875rem 1.75rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-base);
    text-decoration: none;
}

.btn-analyze:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.btn-analyze:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Info section - Steps */
.info-section {
    margin-top: 2.5rem;
    text-align: center;
}

.info-section h2 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.step {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: box-shadow var(--transition-base);
}

.step:hover {
    box-shadow: var(--shadow-md);
}

.step-number {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 auto 0.75rem;
}

.step h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.step p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Results page */
.results-header {
    text-align: center;
    margin-bottom: 2rem;
}

.results-header h1 {
    font-size: 1.75rem;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.results-timestamp {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.result-card h2 {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.image-container {
    background: var(--color-background);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--color-border);
}

.image-container img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
}

.image-filename,
.heatmap-info {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.75rem;
    text-align: center;
}

/* Prediction card */
.prediction-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
}

.prediction-card.prediction-normal {
    border-left: 4px solid var(--color-success);
}

.prediction-card.prediction-pneumonia {
    border-left: 4px solid var(--color-warning);
}

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

.prediction-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.prediction-value {
    font-size: 1.75rem;
    font-weight: 800;
}

.prediction-normal .prediction-value {
    color: var(--color-success);
}

.prediction-pneumonia .prediction-value {
    color: var(--color-warning);
}

/* Confidence section */
.confidence-section {
    margin-bottom: 1.5rem;
}

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

.confidence-value {
    font-weight: 700;
    color: var(--color-primary);
}

.confidence-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-sm);
    transition: width 0.8s ease;
}

.probabilities h3 {
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.probability-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.prob-label {
    width: 90px;
    font-size: 0.9rem;
    font-weight: 500;
}

.prob-bar-container {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.prob-bar {
    height: 100%;
    border-radius: var(--radius-sm);
}

.prob-normal {
    background: var(--color-success);
}

.prob-pneumonia {
    background: var(--color-warning);
}

.prob-value {
    width: 50px;
    font-size: 0.9rem;
    text-align: right;
    font-weight: 600;
}

.results-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.meta-item {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.results-disclaimer {
    margin-bottom: 1rem;
}

.results-actions {
    text-align: center;
}

.results-actions .btn-analyze {
    width: auto;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-icon {
    color: var(--color-error);
    margin-bottom: 1rem;
    font-size: 3rem;
}

.error-page h1 {
    font-size: 1.75rem;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}

.error-message {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1rem;
}

.error-actions .btn-analyze {
    width: auto;
}

/* Footer */
.footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer .disclaimer {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-warning);
}

.footer-info {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
}

.footer-info p {
    margin-bottom: 0.25rem;
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

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

    .results-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .prediction-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
