/* =========================================
   LIQUID JOURNEY WIZARD
   ========================================= */

/* The Container for the entire overlay experience */
#journey-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 99999;
    /* Top of everything */
    pointer-events: none;
    /* Let clicks pass through when inactive */
    display: flex;
    /* Flex to center content */
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#journey-overlay.active {
    pointer-events: auto;
}

/* 
   The Liquid Background Element 
   This expands from the button click position
   Updated for "Midnight Professional" Dark Mode
*/
.liquid-background {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    /* Ink/Watercolor Spread Effect */
    background: var(--bg-main);
    /* Soft Paper Color */
    box-shadow: 0 0 60px 30px rgba(212, 140, 158, 0.15);
    /* Very subtle rose wet edge */
    border-radius: 50%;
    transform: translate(-50%, -50%);
    filter: blur(2px);
    /* Slight softness to the edge itself */

    /* "Gentle Guidance" - Slower, smoother easing */
    transition: width 1.8s cubic-bezier(0.22, 1, 0.36, 1),
        height 1.8s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1;
}

#journey-overlay.active .liquid-background {
    width: 300vmax;
    /* Enough to cover screen from any corner */
    height: 300vmax;
}

/* Wizard Content Container */
.journey-wizard-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    padding: 20px;

    /* Grid Stack Layout for Sliding Steps */
    display: grid;
    grid-template-areas: "step-stack";
    align-items: center;
    justify-items: center;

    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease 0.8s, transform 0.5s ease 0.8s;
    /* Delay until liquid fills (entry) */
    pointer-events: none;
    /* Disable clicks until active */
}

#journey-overlay.active .journey-wizard-container {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Exit Transition for Content (Final fade out) */
.journey-wizard-container.fade-out {
    opacity: 0 !important;
    transform: scale(0.95) !important;
    transition: opacity 0.3s ease 0s, transform 0.3s ease 0s !important;
}

/* Wizard Steps - Stacked */
.wizard-step {
    grid-area: step-stack;
    /* All steps occupy the same space */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;

    /* Default Hidden State */
    opacity: 0;
    pointer-events: none;
    transform: translateX(50px);
    /* Start slightly to right */
    transition: none;
    /* Managed by animation classes */
    visibility: hidden;
    /* Hide from screen readers/tab when inactive */
}

/* Active Step (Static state after animation) */
.wizard-step.active-step {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    visibility: visible;
    /* No animation by default, added by JS classes */
}

/* --- Water Slide Animations --- */

/* Slide In From Right */
.wizard-step.slide-in-right {
    animation: slideInWater 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    visibility: visible;
}

/* Slide Out To Left */
.wizard-step.slide-out-left {
    animation: slideOutWater 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
    pointer-events: none;
}

@keyframes slideInWater {
    0% {
        opacity: 0;
        transform: translateX(60px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOutWater {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-60px) scale(0.95);
    }
}

/* Typography */
.wizard-question {
    font-family: 'Golos Bold', serif;
    font-size: 2.5rem;
    color: var(--text-heading);
    margin-bottom: 10px;
    line-height: 1.2;
}

.wizard-subtext {
    font-family: 'Golos Regular', -apple-system, system-ui, sans-serif;
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 450px;
    margin: 0 auto;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

/* Option Buttons */
.wizard-option {
    background: var(--glass-surface-card);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-subtle);
}

.wizard-option:hover {
    background: var(--glass-surface-primary);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-standard);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.wizard-option.selected {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Level Slider (Reusing or Custom for Wizard) */
.wizard-slider-container {
    width: 100%;
    padding: 20px;
    background: var(--glass-surface-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-subtle);
}

/* Mock Test Section */
.mock-test-container {
    background: var(--glass-surface-card);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-standard);
    width: 100%;
    text-align: left;
}

.test-question {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.test-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.test-option-btn {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    background: #f9f9f9;
    cursor: pointer;
    text-align: left;
    transition: 0.2s;
}

.test-option-btn:hover {
    background: #eef2ff;
    border-color: var(--accent-primary);
}

/* Analyzing Animation */
.analyzing-loader {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
}

.droplet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: ripple 2s infinite linear;
}

.droplet:nth-child(2) {
    animation-delay: 0.5s;
}

.droplet:nth-child(3) {
    animation-delay: 1.0s;
}

@keyframes ripple {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }

    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

.analyzing-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    animation: pulseText 1.5s infinite ease-in-out;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Close Button (Optional) */
.wizard-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 20;
    display: none;
    /* Hard hide by default */
    opacity: 0;
    transition: opacity 0.3s;
}

#journey-overlay.active .wizard-close {
    display: block;
    /* Show when active */
    opacity: 0.5;
}

#journey-overlay.active .wizard-close:hover {
    opacity: 1;
}

/* Station Positioning & Water Float */
.journey-station {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Gentle floating animation by default */
    /* Gentle floating animation by default, plus fade in */
    animation: stationFadeIn 0.6s ease forwards, floatWater 4s ease-in-out infinite;
}

/* Stagger animations for varied feel */
.journey-station[data-station="0"] {
    animation-delay: 0s;
}

.journey-station[data-station="1"] {
    animation-delay: 1.5s;
}

.journey-station[data-station="2"] {
    animation-delay: 0.5s;
}

.journey-station[data-station="3"] {
    animation-delay: 2s;
}

@keyframes floatWater {

    0%,
    100% {
        transform: translate(-50%, -50%) translateY(0);
    }

    50% {
        transform: translate(-50%, -50%) translateY(-10px);
    }
}

/* Active State (When water reaches it) */
.journey-station.active .station-node {
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--accent-primary), inset 0 0 10px white;
    border-color: var(--accent-primary);
}

.journey-station.active .station-info {
    opacity: 1;
    transform: translateY(0);
}

/* Initially hide info until active */
.station-info {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease 0.2s;
}

/* Station Details (Hidden Panel) */
/* ... existing detail/modal CSS ... */
.journey-station:hover .station-node {
    transform: scale(1.1);
    /* Hover scale if not active yet, or add to active */
}

/* Mobile Optimization */
@media (max-width: 768px) {
    /* --- Services Section Mobile --- */

    /* Hide horizontal path */
    .path-connector {
        display: none;
    }

    .stations-container {
        display: flex;
        flex-direction: column;
        height: auto;
        position: relative;
        padding-left: 50px;
        /* Space for line */
        gap: 60px;
        margin-top: 40px;
        margin-bottom: 40px;
    }

    /* Vertical Timeline Track */
    .stations-container::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 20px;
        width: 4px;
        background: rgba(59, 130, 246, 0.2);
        border-radius: 4px;
        z-index: 0;
    }

    /* Vertical Timeline Fill (Animated via JS) */
    .mobile-timeline-fill {
        position: absolute;
        top: 0;
        left: 20px;
        width: 4px;
        height: 0%;
        /* JS updates this */
        background: var(--accent-primary);
        box-shadow: 0 0 15px var(--accent-primary);
        border-radius: 4px;
        z-index: 1;
        transition: height 0.1s linear;
        display: block !important;
        /* Ensure visibility */
    }

    /* Reset Station Positioning */
    .journey-station {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 20px;
        animation: none !important;
        /* Disable float for stability */
        opacity: 0.4;
        /* Start dim */
        transition: opacity 0.5s, transform 0.5s;
    }

    .journey-station.active {
        opacity: 1;
        transform: translateX(10px) !important;
    }

    /* Adjust Station Node */
    .station-node {
        width: 80px;
        height: 80px;
        margin: 0;
        /* Removing auto margins */
        flex-shrink: 0;
    }

    .station-icon {
        width: 40px;
        height: 40px;
    }

    /* Adjust Info Text */
    .station-info {
        text-align: left;
        max-width: none;
        opacity: 1;
        /* Always visible text on mobile, just dim overall */
        transform: none;
    }

    .station-info h4 {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }

    .outcome-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    /* Details Panel (Hidden on mobile for simplicity or adjusted?) */
    .station-details {
        display: none;
    }

    /* --- Wizard Overlay Mobile --- */
    .wizard-question {
        font-size: 1.8rem;
    }

    .wizard-subtext {
        font-size: 1rem;
        padding: 0 20px;
    }

    .options-grid {
        grid-template-columns: 1fr;
        /* Stack options */
    }
}

/* Ensure mobile fill is hidden on desktop */
.mobile-timeline-fill {
    display: none;
}