/**
 * Grit Waitlist - TypeForm-Style Survey Design
 * Full-screen immersive experience with glass morphism
 * Matches parent survey at glassumbrella.io/surveys/parent/
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    --survey-transition-enter: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    --survey-transition-exit: 0.4s cubic-bezier(0.5, 0, 0.75, 0);
    --survey-transition-slide: 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --progress-bg: rgba(255, 255, 255, 0.05);
    --progress-fill: linear-gradient(90deg, var(--color-purple), var(--color-blue), var(--color-sage));
}

/* ==================== FULL VIEWPORT CONTAINER ==================== */

.waitlist-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg,
        rgba(123, 68, 193, 0.3) 0%,
        rgba(20, 20, 30, 0.98) 20%,
        rgba(15, 15, 25, 0.98) 80%,
        rgba(30, 150, 252, 0.3) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.waitlist-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    padding-top: 6rem;
    padding-bottom: 3rem;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
}

.waitlist-question-container {
    width: 100%;
    max-width: 720px;
    position: relative;
    min-height: 400px;
}

/* ==================== PROGRESS BAR ==================== */

.survey-progress-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: linear-gradient(135deg,
        rgba(50, 48, 49, 0.35) 0%,
        rgba(30, 30, 30, 0.25) 50%,
        rgba(45, 45, 45, 0.35) 100%
    );
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    padding: 1rem 2rem;
    padding-right: 80px;
    box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.3);
}

.survey-progress-bar-container {
    position: relative;
    height: 6px;
    background: var(--progress-bg);
    border-radius: 100px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.survey-progress-bar {
    height: 100%;
    background: var(--progress-fill);
    border-radius: 100px;
    transition: width var(--survey-transition-slide);
    position: relative;
    box-shadow: 0 0 20px rgba(154, 213, 202, 0.5);
}

.survey-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent);
    animation: shimmerProgress 2s infinite;
}

@keyframes shimmerProgress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.survey-progress-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #EBEBEB;
    opacity: 0.7;
    text-align: center;
    text-transform: lowercase;
}

/* ==================== CLOSE BUTTON ==================== */

.survey-close {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1002;
    color: #EBEBEB;
    font-size: 1.5rem;
    font-weight: 300;
    text-decoration: none;
    line-height: 1;
}

.survey-close:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.4);
    transform: rotate(90deg);
    color: #EBEBEB;
    text-decoration: none;
}

/* ==================== INTRO CARD ==================== */

.waitlist-intro-card {
    background: linear-gradient(135deg,
        rgba(50, 48, 49, 0.35) 0%,
        rgba(30, 30, 30, 0.25) 50%,
        rgba(45, 45, 45, 0.35) 100%
    );
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 4rem 3rem;
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        0 2px 16px 0 rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.waitlist-intro-card.hidden {
    display: none;
}

.intro-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #EBEBEB;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-transform: lowercase;
}

.intro-subtitle {
    font-size: 1.25rem;
    color: rgba(235, 235, 235, 0.7);
    margin-bottom: 2.5rem;
    text-transform: lowercase;
}

.trust-indicators {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-sage);
    font-size: 0.9rem;
}

.trust-badge svg {
    color: var(--color-sage);
}

.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.125rem 3rem;
    background: var(--color-sage);
    border: none;
    color: var(--color-charcoal);
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(154, 213, 202, 0.4);
    text-transform: lowercase;
}

.btn-start:hover {
    background: #7DCBB8;
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(154, 213, 202, 0.5);
}

.btn-start svg {
    transition: transform 0.3s ease;
}

.btn-start:hover svg {
    transform: translateX(4px);
}

.intro-time {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: rgba(235, 235, 235, 0.5);
    text-transform: lowercase;
}

/* ==================== FORM CARD ==================== */

.waitlist-form-card {
    display: none;
    width: 100%;
}

.waitlist-form-card.active {
    display: block;
}

/* ==================== FORM SECTIONS (Question Cards) ==================== */

.form-section {
    background: linear-gradient(135deg,
        rgba(50, 48, 49, 0.35) 0%,
        rgba(30, 30, 30, 0.25) 50%,
        rgba(45, 45, 45, 0.35) 100%
    );
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.2),
        0 2px 16px 0 rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: none;
    opacity: 0;
    transform: translateX(100px);
    transition: all var(--survey-transition-enter);
}

.form-section.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
    animation: slideInFromRight var(--survey-transition-enter);
}

.form-section.exiting {
    opacity: 0;
    transform: translateX(-100px);
    transition: all var(--survey-transition-exit);
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-section.from-backward {
    animation: slideInFromLeft var(--survey-transition-enter);
}

/* ==================== SECTION HEADERS ==================== */

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #EBEBEB;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    text-transform: lowercase;
}

.section-description {
    font-size: 1rem;
    color: rgba(235, 235, 235, 0.7);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    text-transform: lowercase;
}

/* ==================== FORM GROUPS ==================== */

.form-group {
    margin-bottom: 2.5rem;
}

.form-label {
    display: block;
    color: #EBEBEB;
    font-weight: 500;
    margin-bottom: 1rem;
    font-size: 1.125rem;
    text-transform: lowercase;
}

.label-hint {
    display: block;
    font-weight: 400;
    color: rgba(235, 235, 235, 0.5);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.label-optional {
    font-weight: 400;
    color: rgba(235, 235, 235, 0.4);
    font-size: 0.875rem;
}

/* ==================== TEXT INPUTS ==================== */

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #EBEBEB;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 1.125rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-sage);
    box-shadow: 0 0 0 4px rgba(154, 213, 202, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: rgba(235, 235, 235, 0.4);
}

.form-control.is-invalid {
    border-color: #ff6b6b;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15);
}

/* ==================== AGE RANGE INPUTS ==================== */

.age-range-inputs {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.age-input-row {
    display: grid;
    grid-template-columns: 100px 80px 1fr;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.age-input-row:last-child {
    margin-bottom: 0;
}

.age-input-row label {
    color: #EBEBEB;
    font-size: 0.95rem;
    margin-bottom: 0;
    text-transform: lowercase;
}

.age-input {
    width: 100%;
    text-align: center;
}

.age-label {
    color: rgba(235, 235, 235, 0.5);
    font-size: 0.9rem;
    text-transform: lowercase;
}

/* ==================== RADIO & CHECKBOX OPTIONS (TypeForm Style) ==================== */

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-option,
.checkbox-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.radio-option::before,
.checkbox-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-sage);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.radio-option:hover,
.checkbox-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(154, 213, 202, 0.4);
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(154, 213, 202, 0.15);
}

.radio-option:hover::before,
.checkbox-option:hover::before {
    transform: scaleY(1);
}

.radio-option:has(input:checked),
.checkbox-option:has(input:checked) {
    background: rgba(154, 213, 202, 0.1);
    border-color: var(--color-sage);
    box-shadow: 0 4px 20px rgba(154, 213, 202, 0.25);
}

.radio-option:has(input:checked)::before,
.checkbox-option:has(input:checked)::before {
    transform: scaleY(1);
    background: linear-gradient(180deg, var(--color-sage), var(--color-blue));
}

/* Custom Radio/Checkbox Indicators */
.radio-option input[type="radio"],
.checkbox-option input[type="checkbox"] {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.checkbox-option input[type="checkbox"] {
    border-radius: 6px;
}

.radio-option input[type="radio"]:checked,
.checkbox-option input[type="checkbox"]:checked {
    border-color: var(--color-sage);
    background: var(--color-sage);
    box-shadow: 0 0 12px rgba(154, 213, 202, 0.6);
}

.radio-option input[type="radio"]:checked::after,
.checkbox-option input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-charcoal);
    font-size: 14px;
    font-weight: 700;
}

.radio-label,
.checkbox-label {
    flex: 1;
    color: #EBEBEB;
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-transform: lowercase;
}

/* Other input field */
.other-input {
    margin-top: 0.75rem;
    margin-left: 2.5rem;
}

/* ==================== INFO CALLOUT ==================== */

.info-callout {
    background: rgba(30, 150, 252, 0.1);
    border-left: 4px solid var(--color-blue);
    padding: 1rem 1.25rem;
    border-radius: 0 12px 12px 0;
    margin-bottom: 1.5rem;
}

.info-callout p {
    margin: 0.5rem 0;
    color: rgba(235, 235, 235, 0.9);
    font-size: 0.95rem;
    line-height: 1.5;
    text-transform: lowercase;
}

.info-callout p:first-child {
    margin-top: 0;
}

.info-callout p:last-child {
    margin-bottom: 0;
}

/* ==================== PASSWORD FIELD ==================== */

.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(235, 235, 235, 0.5);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--color-sage);
}

.password-strength {
    margin-top: 1rem;
}

.strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 100px;
}

.strength-fill.strength-weak { background: #ff6b6b; }
.strength-fill.strength-fair { background: #ffa94d; }
.strength-fill.strength-good { background: #69db7c; }
.strength-fill.strength-strong { background: var(--color-sage); }

.strength-text {
    color: rgba(235, 235, 235, 0.6);
    font-size: 0.875rem;
    text-transform: lowercase;
}

#strength-label {
    font-weight: 500;
}

/* ==================== REFERRAL CODE FEEDBACK ==================== */

.referral-feedback {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.referral-feedback.validating {
    color: rgba(235, 235, 235, 0.7);
    background: rgba(255, 255, 255, 0.05);
}

.referral-feedback.valid {
    color: var(--color-sage);
    background: rgba(154, 213, 202, 0.1);
    border: 1px solid rgba(154, 213, 202, 0.3);
}

.referral-feedback.invalid {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* ==================== FORM TEXT & VALIDATION ==================== */

.form-text {
    display: block;
    margin-top: 0.75rem;
    color: rgba(235, 235, 235, 0.5);
    font-size: 0.875rem;
    line-height: 1.4;
    text-transform: lowercase;
}

.invalid-feedback {
    display: none;
    margin-top: 0.75rem;
    color: #ff6b6b;
    font-size: 0.875rem;
}

.form-control.is-invalid ~ .invalid-feedback,
.form-group.is-invalid .invalid-feedback {
    display: block;
}

/* ==================== NAVIGATION BUTTONS ==================== */

.section-actions {
    display: flex;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #EBEBEB;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: lowercase;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-4px);
}

.btn-next {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--color-sage);
    border: 2px solid var(--color-sage);
    color: var(--color-charcoal);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(154, 213, 202, 0.3);
    text-transform: lowercase;
}

.btn-next:hover {
    background: #7DCBB8;
    transform: translateX(4px);
    box-shadow: 0 6px 24px rgba(154, 213, 202, 0.5);
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.125rem 2.5rem;
    background: var(--color-purple);
    border: 2px solid #EBEBEB;
    color: #EBEBEB;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(123, 68, 193, 0.4);
    text-transform: lowercase;
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(to bottom, var(--color-blue) 5%, var(--color-purple) 100%);
    transform: scale(1.02);
    box-shadow: 0 6px 28px rgba(30, 150, 252, 0.5);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading spinner */
.spinner {
    animation: rotate 1s linear infinite;
}

.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
    .survey-progress-wrapper {
        padding: 0.75rem 1rem;
        padding-right: 60px;
    }

    .survey-close {
        top: 0.75rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .waitlist-wrapper {
        padding: 1rem;
        padding-top: 5rem;
        padding-bottom: 6rem;
    }

    .waitlist-intro-card {
        padding: 2.5rem 1.5rem;
    }

    .intro-title {
        font-size: 1.75rem;
    }

    .intro-subtitle {
        font-size: 1rem;
    }

    .trust-indicators {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .btn-start {
        width: 100%;
        justify-content: center;
        padding: 1rem 2rem;
        font-size: 1.125rem;
    }

    .form-section {
        padding: 2rem 1.5rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-description {
        font-size: 0.95rem;
    }

    .radio-option,
    .checkbox-option {
        padding: 1rem;
    }

    .radio-label,
    .checkbox-label {
        font-size: 1rem;
    }

    .age-input-row {
        grid-template-columns: 80px 60px 1fr;
        gap: 0.5rem;
    }

    .age-input-row label {
        font-size: 0.875rem;
    }

    .section-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .btn-back,
    .btn-next,
    .btn-submit {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }

    .form-control {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* ==================== TABLET (768px - 1024px) ==================== */

@media (min-width: 768px) and (max-width: 1024px) {
    .waitlist-wrapper {
        padding: 2rem 1.5rem;
        padding-top: 6rem;
    }

    .waitlist-intro-card {
        padding: 3rem 2rem;
    }

    .form-section {
        padding: 2.5rem 2rem;
    }
}

/* ==================== ACCESSIBILITY ==================== */

/* Focus visible states */
.form-control:focus-visible,
.btn-next:focus-visible,
.btn-back:focus-visible,
.btn-submit:focus-visible,
.btn-start:focus-visible,
.radio-option:focus-within,
.checkbox-option:focus-within {
    outline: 3px solid var(--color-sage);
    outline-offset: 3px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .survey-progress-bar::after {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }

    .radio-option,
    .checkbox-option {
        border-width: 3px;
    }

    .trust-badge {
        font-weight: 700;
    }
}
