/* ===================================
   SLEEP TEST MODAL - REDESIGNED
   Matches Landing Page Aesthetic
   =================================== */

/* Modal Root */
.sleep-test-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sleep-test-modal.active {
    opacity: 1;
    pointer-events: all;
}

/* Overlay - Subtle and Elegant */
.sleep-test-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 28, 24, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Modal Container - Compact and Refined with Glassmorphism */
.sleep-test-container {
    position: relative;
    background: rgba(var(--bg-card-rgb, 31, 28, 24), 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: clamp(2rem, 4vw, 2.5rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.sleep-test-modal.active .sleep-test-container {
    transform: scale(1) translateY(0);
}

/* Custom Scrollbar */
.sleep-test-container::-webkit-scrollbar {
    width: 8px;
}

.sleep-test-container::-webkit-scrollbar-track {
    background: rgba(201, 162, 77, 0.05);
    border-radius: 4px;
}

.sleep-test-container::-webkit-scrollbar-thumb {
    background: rgba(201, 162, 77, 0.3);
    border-radius: 4px;
}

.sleep-test-container::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 162, 77, 0.5);
}

/* Close Button */
.sleep-test-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0.6;
}

.sleep-test-close:hover {
    opacity: 1;
    background: rgba(201, 162, 77, 0.1);
    transform: rotate(90deg);
}

/* Screen Transitions - Smooth Slide */
.sleep-test-screen {
    animation: fadeSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

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

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

/* Welcome Screen */
.welcome-screen {
    text-align: center;
}

/* Email Screen - Ensure Centered Alignment */
.email-screen {
    text-align: center;
}

/* Typography - Matching Landing Page */
.sleep-test-title {
    font-family: var(--font-headline);
    font-size: clamp(28px, 5vw, 36px);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.sleep-test-subtitle {
    font-family: var(--font-body);
    font-size: clamp(15px, 2vw, 17px);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
    font-weight: 400;
    opacity: 0.9;
}

/* Buttons */
.sleep-test-btn {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: block;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    padding: 1rem 2rem;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.sleep-test-btn.btn-primary {
    background-color: var(--color-accent-gold);
    color: #2E2B28;
}

.sleep-test-btn.btn-primary:hover {
    background-color: var(--color-accent-gold-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(201, 162, 77, 0.3);
}

/* Email Screen */
.sleep-test-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Input Fields */
.sleep-test-input {
    font-family: var(--font-body);
    font-size: 15px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.sleep-test-input:focus {
    outline: none;
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 77, 0.1);
}

.sleep-test-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.sleep-test-privacy {
    text-align: center;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Question Screen */
.sleep-test-progress {
    width: 100%;
    height: 4px;
    background: rgba(201, 162, 77, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.sleep-test-progress-bar {
    height: 100%;
    background: var(--color-accent-gold);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sleep-test-progress-text {
    text-align: center;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.7;
}

.sleep-test-question {
    font-family: var(--font-headline);
    font-size: clamp(22px, 4vw, 26px);
    color: var(--text-primary);
    margin-bottom: 1.75rem;
    line-height: 1.5;
    font-weight: 500;
    letter-spacing: -0.3px;
}

/* Answer Options */
.sleep-test-answers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sleep-test-answer {
    font-family: var(--font-body);
    font-size: 15px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-weight: 400;
}

.sleep-test-answer:hover {
    border-color: var(--color-accent-gold);
    background: var(--bg-secondary);
    transform: translateY(-2px) translateX(4px);
    box-shadow: 0 4px 12px rgba(201, 162, 77, 0.15);
}

/* Results Screen */
.results-screen {
    text-align: center;
}

/* Score Container - Compact */
.sleep-test-score-container {
    margin-bottom: 2rem;
    padding: 2rem 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
}

.sleep-test-score-label {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    font-weight: 600;
    opacity: 0.7;
}

.sleep-test-score {
    font-family: var(--font-headline);
    font-size: clamp(48px, 8vw, 64px);
    color: var(--color-accent-gold);
    font-weight: 600;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.sleep-test-score-max {
    font-family: var(--font-body);
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 400;
    opacity: 0.6;
}

/* Profile Section */
.sleep-test-profile {
    margin-bottom: 1.5rem;
}

.sleep-test-profile-name {
    font-family: var(--font-headline);
    font-size: clamp(22px, 3.5vw, 28px);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.sleep-test-pain-point {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-accent-earth);
    font-weight: 500;
    padding: 1rem 1.25rem;
    background: rgba(164, 106, 74, 0.08);
    border-radius: var(--radius-btn);
    border-left: 3px solid var(--color-accent-earth);
    line-height: 1.5;
}

/* Why & Solution Sections - Compact */
.sleep-test-why,
.sleep-test-solution {
    text-align: left;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
}

.sleep-test-why h4,
.sleep-test-solution h4 {
    font-family: var(--font-headline);
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.sleep-test-why p,
.sleep-test-solution p {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    opacity: 0.9;
}

/* Social Proof */
.sleep-test-social-proof {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-accent-gold);
    font-weight: 500;
    padding: 1rem 1.25rem;
    background: rgba(201, 162, 77, 0.08);
    border-radius: var(--radius-btn);
    margin-bottom: 2rem;
    font-style: italic;
    opacity: 0.9;
}

/* CTA Section */
.sleep-test-cta {
    margin-bottom: 1rem;
}

.sleep-test-retake {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 400;
    opacity: 0.7;
}

.sleep-test-retake:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sleep-test-container {
        width: 95%;
        padding: 1.75rem 1.5rem;
        max-height: 85vh;
    }

    .sleep-test-title {
        font-size: 24px;
    }

    .sleep-test-subtitle {
        font-size: 15px;
        margin-bottom: 1.5rem;
    }

    .sleep-test-question {
        font-size: 19px;
        margin-bottom: 1.25rem;
    }

    .sleep-test-score {
        font-size: 48px;
    }

    .sleep-test-profile-name {
        font-size: 20px;
    }

    .sleep-test-answer {
        padding: 0.875rem 1rem;
        font-size: 14px;
    }

    .sleep-test-btn {
        font-size: 15px;
        padding: 0.875rem 1.5rem;
    }

    .sleep-test-score-container {
        padding: 1.5rem 1.25rem;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .sleep-test-modal,
    .sleep-test-container,
    .sleep-test-btn,
    .sleep-test-input,
    .sleep-test-answer,
    .sleep-test-progress-bar,
    .sleep-test-score {
        animation: none !important;
        transition: none !important;
    }
}