/* --- VARIABLES & RESET --- */
:root {
    /* Premium Dark Palette */
    --bg-dark: #0f111a;
    --bg-dark-secondary: #1a1d2d;

    /* Deep Mystical Colors */
    --primary: #6d28d9;
    /* Violet */
    --primary-glow: rgba(109, 40, 217, 0.5);
    --secondary: #0ea5e9;
    /* Sky Blue */

    /* Accents */
    --accent-gold: #d4af37;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 16px;

    /* Spacing */
    --radius-lg: 24px;
    --radius-md: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* --- BACKGROUND --- */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, #170d30 0%, var(--bg-dark) 90%);
    z-index: -2;
}

.app-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,...');
    /* Add noise if needed */
    z-index: -1;
    pointer-events: none;
}

/* --- LAYOUT --- */
.main-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.view-section {
    width: 100%;
    max-width: 600px;
    transition: opacity 0.5s ease;
}

.view-section.hidden {
    display: none;
    opacity: 0;
}

.view-section.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.8s ease-out;
}

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

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

/* --- CARDS & GLASSMORPHISM --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
}

/* --- HERO --- */
.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* --- BUTTONS --- */
.btn {
    padding: 14px 32px;
    border-radius: 50px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- STEPPER & ASSESSMENT --- */
.stepper-header {
    margin-bottom: 30px;
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gold);
    width: 0%;
    transition: width 0.4s ease;
}

#step-indicator {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.options-grid {
    display: grid;
    gap: 15px;
    margin-top: 30px;
}

.option-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
}

.option-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* --- REPORT (DISPLAY) --- */
#report-section {
    max-width: 800px;
    /* A4 width approx */
}

/* --- PREMIUM REPORT THEME (Dark) --- */
:root {
    --report-bg: #0f172a;
    /* Deep Navy */
    --report-card-bg: rgba(30, 41, 59, 0.7);
    --report-text: #f1f5f9;
    --report-accent: #fbbf24;
    /* Gold */
}

.clinical-report {
    background: var(--report-bg);
    color: var(--report-text);
    max-width: 1000px;
    /* Wider for the grid layout */
    padding: 0;
    overflow: hidden;
    position: relative;
}

.report-header {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 1) 100%), url('https://source.unsplash.com/random/1200x400/?galaxy,connection') no-repeat top center;
    background-size: cover;
    padding: 60px 40px 40px;
    text-align: center;
    border-bottom: none;
}

.report-meta h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.report-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: #cbd5e1;
    font-weight: 300;
}

/* --- GRID LAYOUT --- */
.report-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    padding: 40px;
}

/* Specific Areas */
.area-intro {
    grid-column: span 4;
}

.area-main {
    grid-column: span 4;
}

.area-constellation {
    grid-column: span 4;
}

.area-coordinates {
    grid-column: span 12;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .report-grid {
        display: flex;
        flex-direction: column;
    }

    .area-coordinates {
        grid-template-columns: 1fr;
    }
}

/* Card Styles */
.report-card {
    background: var(--report-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
}

.card-title {
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* Bar Chart Styles */
.bar-chart-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.bar-label {
    width: 100px;
    text-align: right;
    padding-right: 10px;
    color: #94a3b8;
}

.bar-track {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
}

.bar-value {
    width: 40px;
    text-align: right;
    padding-left: 10px;
    color: white;
    font-weight: bold;
}

/* Quadrant Chart Styles */
.quadrant-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    background: #1e293b;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.quadrant {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px;
}

.quadrant.active {
    background: rgba(var(--primary-rgb), 0.2);
    color: white;
    font-weight: bold;
    border: 2px solid var(--primary);
}

/* --- PRINT STYLES (A4 CLEAN) --- */
@media print {
    @page {
        margin: 1.5cm;
        size: A4;
    }

    body {
        background: white !important;
        color: #1e293b !important;
        /* Slate 800 */
        visibility: visible !important;
        font-size: 11pt;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide UI & Decor */
    .app-background,
    .app-overlay,
    .dont-print,
    .decorative-arch,
    .hero-section,
    .assessment-section,
    .processing-section,
    #btn-download-png {
        display: none !important;
    }

    /* Reset Container */
    .main-container {
        display: block;
        padding: 0;
        margin: 0;
        min-height: auto;
    }

    /* Report Visibility & Reset */
    #report-section,
    #report-content-container {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    .clinical-report {
        background: white !important;
        color: #1e293b !important;
        box-shadow: none !important;
        max-width: 100% !important;
    }

    /* Header Reset */
    .report-header {
        background: none !important;
        padding: 0 0 20px 0 !important;
        border-bottom: 2px solid #0f172a;
        margin-bottom: 30px;
        color: #0f172a !important;
    }

    .report-meta h1 {
        color: #0f172a !important;
        font-size: 24pt !important;
        text-shadow: none !important;
    }

    .report-tagline {
        color: #64748b !important;
    }

    /* Grid to Linear Layout */
    .report-grid {
        display: block !important;
        /* Stack everything */
        padding: 0 !important;
        gap: 0 !important;
    }

    /* Card Reset - Remove Glassmorphism */
    .report-card {
        background: white !important;
        backdrop-filter: none !important;
        border: none !important;
        border-bottom: 1px solid #e2e8f0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 20px 0 !important;
        margin-bottom: 20px !important;
        break-inside: avoid;
        /* Prevent cutting cards in half */
    }

    .card-title {
        color: #64748b !important;
        /* Muted Slate */
        border-bottom: 1px solid #cbd5e1 !important;
        font-weight: bold;
    }

    /* Text Colors */
    p,
    li,
    span,
    div {
        color: #1e293b !important;
    }

    strong,
    h1,
    h2,
    h3,
    h4,
    h5 {
        color: #0f172a !important;
    }

    /* Specific Elements overrides */
    .bar-track {
        background: #e2e8f0 !important;
    }

    .bar-value {
        color: #0f172a !important;
    }

    .quadrant-container {
        background: white !important;
        border: 1px solid #cbd5e1;
    }

    .quadrant {
        border-color: #e2e8f0 !important;
        color: #64748b !important;
    }

    .quadrant.active {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        border: 2px solid #0f172a !important;
    }

    /* Avatar & Images */
    .area-main img {
        filter: none !important;
        /* Remove any heavy filters */
        opacity: 1 !important;
    }

    /* Remove specific dark-mode accents */
    div[style*="background:rgba(255,255,255,0.03)"],
    div[style*="background:rgba(255,255,255,0.05)"] {
        background: #f8fafc !important;
        /* Very light gray */
        border: 1px solid #e2e8f0 !important;
        color: #1e293b !important;
    }

    /* Force accents to be darker for print contrast */
    [style*="color:#cbd5e1"],
    [style*="color:#94a3b8"] {
        color: #475569 !important;
    }
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {

    /* ... existing mobile styles ... */
    .glass-card {
        padding: 24px;
        margin: 10px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .clinical-report {
        padding: 30px;
    }

    .report-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .report-meta h1 {
        font-size: 1.5rem;
    }
}

/* --- LOADING SPINNER --- */
.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 20px;
}

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

/* --- DECORATIVE IMAGES (HERO) --- */
.decorative-arch {
    position: absolute;
    z-index: -1;
    opacity: 0.4;
    max-height: 80vh;
    width: auto;
    pointer-events: none;
    transition: all 0.5s ease;
}

/* Top Right Position */
.arch-top-right {
    top: 0;
    right: 0;
    transform: translate(10%, -10%);
    mask-image: linear-gradient(to bottom left, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom left, black 50%, transparent 100%);
}

/* Bottom Left Position */
.arch-bottom-left {
    bottom: 0;
    left: 0;
    transform: translate(-10%, 10%);
    mask-image: linear-gradient(to top right, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top right, black 50%, transparent 100%);
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .decorative-arch {
        max-height: 60vh;
        opacity: 0.3;
    }
}

@media (max-width: 768px) {
    .decorative-arch {
        max-height: 40vh;
        opacity: 0.25;
    }

    .arch-top-right {
        top: 20px;
        right: -20px;
    }

    .arch-bottom-left {
        bottom: 20px;
        left: -20px;
    }
}