/* EPAS Modern Editorial Theme */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&family=Playfair+Display:wght@500;600;700;800&display=swap');

:root {
    /* --- Palette: Artistic & Vibrant --- */
    --c-bg-page: #FDFBF7;
    /* Warm Paper */
    --c-bg-surface: #FFFFFF;
    /* Pure White */
    --c-bg-subtle: #F3F4F6;
    /* Cool Gray */

    --c-text-main: #1E1B4B;
    /* Deep Indigo (Almost Black) */
    --c-text-body: #374151;
    /* Gray 700 */
    --c-text-muted: #6B7280;
    /* Gray 500 */

    /* Accents - The "Art" */
    --c-primary: #4F46E5;
    /* Indigo 600 */
    --c-primary-light: #E0E7FF;
    /* Indigo 100 */
    --c-secondary: #F43F5E;
    /* Rose 500 */
    --c-tertiary: #0EA5E9;
    /* Sky 500 */
    --c-accent: #F59E0B;
    /* Amber 500 */

    --c-border: #E5E7EB;

    /* --- Dimensions & Shape --- */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --control-height: 56px;

    /* --- Typography --- */
    --font-heading: 'Playfair Display', serif;
    /* Artistic Serif */
    --font-ui: 'Outfit', sans-serif;
    /* Modern Sans */

    /* --- Shadows (Colored & Soft) --- */
    --shadow-sm: 0 2px 4px rgba(79, 70, 229, 0.05);
    --shadow-card: 0 10px 30px -5px rgba(79, 70, 229, 0.08);
    --shadow-float: 0 20px 40px -10px rgba(79, 70, 229, 0.15);
    --shadow-glow: 0 0 0 4px rgba(79, 70, 229, 0.15);

    /* --- Animation --- */
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--c-bg-page);
    color: var(--c-text-body);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;

    /* Subtle Mesh Gradient Background */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(79, 70, 229, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(244, 63, 94, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(14, 165, 233, 0.03) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Utility */
.hidden {
    display: none !important;
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--c-text-main);
    line-height: 1.2;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
    max-width: 70ch;
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.screen {
    display: none;
    padding: 4rem 0;
    min-height: 100vh;
}

.screen.active {
    display: block;
    animation: slideUpFade 0.8s var(--ease-elastic);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

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

/* --- Components: The "Art" Details --- */

/* 1. Glass Panel (Cards) */
.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

/* 2. Buttons (Coordinated) */
.btn-glow,
.btn-glass {
    height: var(--control-height);
    padding: 0 2rem;
    border-radius: var(--radius-xl);
    /* Pill shape */
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-glow {
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-glow:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-glow:disabled {
    background: var(--c-text-muted);
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-glass {
    background: white;
    border: 2px solid var(--c-bg-subtle);
    color: var(--c-text-main);
}

.btn-glass:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: var(--c-bg-surface);
}

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

/* 3. Inputs (Matching Buttons) */
.glass-select,
.glass-input {
    height: var(--control-height);
    padding: 0 1.5rem;
    background: white;
    border: 2px solid var(--c-bg-subtle);
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--c-text-main);
    width: 100%;
    transition: all 0.2s;
}

.glass-select:focus,
.glass-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: var(--shadow-glow);
}

textarea.glass-select {
    height: auto;
    min-height: 160px;
    padding: 1.5rem;
    resize: vertical;
}

/* --- Screens --- */

/* Loading */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--c-bg-page);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease;
}

.loader-ring {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(79, 70, 229, 0.1);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 1.5rem;
}

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

/* Welcome Screen */
.welcome-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--c-text-body);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.onboarding-panel {
    padding: 2.5rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    position: relative;
    overflow: hidden;
}

.onboarding-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-text-main);
    font-family: var(--font-heading);
    /* Serif label for contrast */
}

.hero-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.floating-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-smooth);
    border: 1px solid transparent;
}

.floating-card:hover {
    transform: translateX(-10px);
    box-shadow: var(--shadow-card);
    border-color: var(--c-primary-light);
}

.floating-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--c-text-main);
}

.floating-card div:first-child {
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

/* Test Layout */
.test-layout {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.test-header {
    padding: 1.5rem 2.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.progress-track {
    flex: 1;
    height: 8px;
    background: var(--c-bg-subtle);
    border-radius: 10px;
    margin: 0 3rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
    width: 0%;
    transition: width 0.6s var(--ease-smooth);
}

.test-content-area {
    padding: 3rem;
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Questions */
.question-item {
    animation: slideUpFade 0.5s var(--ease-smooth);
}

.question-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--c-text-main);
    margin-bottom: 2.5rem;
    line-height: 1.4;
}

.question-context {
    background: var(--c-primary-light);
    padding: 2rem;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--c-primary);
    margin-bottom: 2.5rem;
    font-style: italic;
    color: var(--c-text-main);
    font-size: 1.1rem;
}

/* Option Cards */
.options-grid {
    display: grid;
    gap: 1rem;
}

.option-card {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    background: white;
    border: 2px solid var(--c-bg-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.option-card:hover {
    border-color: var(--c-primary);
    background: #F5F7FF;
    transform: translateX(5px);
}

.option-card.selected {
    border-color: var(--c-primary);
    background: #EEF2FF;
    box-shadow: var(--shadow-glow);
}

.option-key {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-bg-subtle);
    border-radius: 10px;
    font-weight: 700;
    margin-right: 1.5rem;
    color: var(--c-text-muted);
    font-family: var(--font-ui);
    transition: all 0.2s;
}

.option-card.selected .option-key {
    background: var(--c-primary);
    color: white;
}

/* Split View */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    height: 100%;
}

.context-panel {
    background: var(--c-bg-page);
    padding: 2rem;
    border-radius: var(--radius-lg);
    height: fit-content;
    max-height: 75vh;
    overflow-y: auto;
    border: 1px solid var(--c-border);
}

/* Audio Player */
.audio-player {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.audio-progress {
    height: 6px;
    background: var(--c-bg-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.audio-progress .progress-bar {
    height: 100%;
    background: var(--c-secondary);
    /* Rose color for audio */
    width: 0%;
}

/* Results */
.results-dashboard {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 3rem;
}

.score-panel {
    background: white;
    padding: 3rem;
    text-align: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.score-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
}

.big-score {
    font-family: var(--font-heading);
    font-size: 7rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin: 1rem 0;
}

.analysis-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    border: 1px solid var(--c-border);
}

.analysis-card h3 {
    border-bottom: 2px solid var(--c-bg-subtle);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    color: var(--c-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem;
    background: var(--c-bg-subtle);
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--c-text-muted);
}

th:first-child {
    border-top-left-radius: 8px;
}

th:last-child {
    border-top-right-radius: 8px;
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--c-border);
}

tr:last-child td {
    border-bottom: none;
}

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

    .welcome-grid,
    .split-view,
    .results-dashboard {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 1rem;
    }

    h1 {
        font-size: 2.5rem;
    }
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.image-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    z-index: 10001;
    max-width: 90vw;
    max-height: 90vh;
    animation: scaleIn 0.3s var(--ease-elastic);
}

.image-modal-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-main);
    box-shadow: var(--shadow-card);
    transition: all 0.2s;
}

.image-modal-close:hover {
    background: var(--c-secondary);
    color: white;
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Question Image Styles */
.question-image {
    border: 2px solid var(--c-border);
    transition: all 0.3s ease;
}

.question-image:hover {
    border-color: var(--c-primary);
    box-shadow: var(--shadow-float);
}