/**
 * Nordnatur Quiz - Frontend Styles
 *
 * Quiz styling using GeneratePress CSS custom properties.
 * Follows Nordnatur brand: calm, natural, supportive.
 *
 * @package NordnaturQuiz
 * @since 1.0.0
 */

/* ==========================================================================
   Quiz Container
   ========================================================================== */

.nnq-quiz {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ==========================================================================
   Steps (Screens)
   ========================================================================== */

.nnq-step {
    display: none;
    animation: nnqFadeIn 0.3s ease-out;
}

.nnq-step--active {
    display: block;
}

.nnq-step__content {
    background: var(--base-3, #ffffff);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

/* ==========================================================================
   Email Capture Step
   ========================================================================== */

.nnq-step__title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--contrast, #192321);
    margin: 0 0 1rem;
    line-height: 1.3;
}

.nnq-step__intro {
    font-size: 1rem;
    color: var(--contrast-2, #3E4B47);
    margin: 0 0 2rem;
    line-height: 1.6;
}

.nnq-email-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ==========================================================================
   Form Fields
   ========================================================================== */

.nnq-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nnq-field__label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--contrast, #192321);
}

.nnq-field__input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--contrast-3, #63756f);
    border-radius: 8px;
    background: var(--base-3, #ffffff);
    color: var(--contrast, #192321);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nnq-field__input:focus {
    outline: none;
    border-color: var(--accent, #95427b);
    box-shadow: 0 0 0 3px var(--accent-3, #E3CFDA);
}

.nnq-field__input::placeholder {
    color: var(--contrast-3, #63756f);
}

.nnq-field__error {
    font-size: 0.875rem;
    color: #c73b3b;
    min-height: 1.25rem;
}

/* ==========================================================================
   Checkbox
   ========================================================================== */

.nnq-field--checkbox {
    margin-top: 0.5rem;
}

.nnq-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    position: relative;
}

.nnq-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.nnq-checkbox__mark {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--contrast-3, #63756f);
    border-radius: 4px;
    background: var(--base-3, #ffffff);
    margin-top: 2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nnq-checkbox__mark::after {
    content: "";
    width: 6px;
    height: 10px;
    border: solid var(--base-3, #ffffff);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s;
}

.nnq-checkbox input:checked + .nnq-checkbox__mark {
    background: var(--accent, #95427b);
    border-color: var(--accent, #95427b);
}

.nnq-checkbox input:checked + .nnq-checkbox__mark::after {
    transform: rotate(45deg) scale(1);
}

.nnq-checkbox input:focus + .nnq-checkbox__mark {
    box-shadow: 0 0 0 3px var(--accent-3, #E3CFDA);
}

.nnq-checkbox__text {
    font-size: 0.9375rem;
    color: var(--contrast-2, #3E4B47);
    line-height: 1.5;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.nnq-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.nnq-button--primary {
    background: var(--accent, #95427b);
    color: var(--base-3, #ffffff);
}

.nnq-button--primary:hover {
    background: var(--accent-2, #b46b91);
}

.nnq-button--primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-3, #E3CFDA);
}

.nnq-button--secondary {
    background: transparent;
    color: var(--contrast-2, #3E4B47);
    border: 1px solid var(--contrast-3, #63756f);
}

.nnq-button--secondary:hover {
    background: var(--base, #F3F1ED);
}

.nnq-button--secondary:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--base, #F3F1ED);
}

.nnq-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nnq-button__arrow {
    font-size: 1.125rem;
    line-height: 1;
}

/* ==========================================================================
   Progress Indicator
   ========================================================================== */

.nnq-progress {
    margin-bottom: 1.5rem;
}

.nnq-progress__text {
    font-size: 0.875rem;
    color: var(--contrast-3, #63756f);
    margin-bottom: 0.5rem;
    display: block;
}

.nnq-progress__bar {
    height: 4px;
    background: var(--base, #F3F1ED);
    border-radius: 2px;
    overflow: hidden;
}

.nnq-progress__fill {
    height: 100%;
    background: var(--accent, #95427b);
    border-radius: 2px;
    transition: width 0.3s ease-out;
}

/* ==========================================================================
   Question
   ========================================================================== */

.nnq-question__text {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--contrast, #192321);
    margin: 0 0 1.5rem;
    line-height: 1.4;
}

/* ==========================================================================
   Options (Radio Buttons as Cards)
   ========================================================================== */

.nnq-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.nnq-option {
    cursor: pointer;
}

.nnq-option__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.nnq-option__card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: var(--base-2, #FAF9F7);
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.2s;
}

.nnq-option:hover .nnq-option__card {
    background: var(--base, #F3F1ED);
}

.nnq-option__input:checked + .nnq-option__card {
    background: var(--accent-3, #E3CFDA);
    border-color: var(--accent, #95427b);
}

.nnq-option__input:focus + .nnq-option__card {
    box-shadow: 0 0 0 3px var(--accent-3, #E3CFDA);
}

.nnq-option__indicator {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--contrast-3, #63756f);
    border-radius: 50%;
    background: var(--base-3, #ffffff);
    margin-top: 1px;
    position: relative;
    transition: all 0.2s;
}

.nnq-option__indicator::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background: var(--accent, #95427b);
    border-radius: 50%;
    transition: transform 0.15s;
}

.nnq-option__input:checked + .nnq-option__card .nnq-option__indicator {
    border-color: var(--accent, #95427b);
}

.nnq-option__input:checked + .nnq-option__card .nnq-option__indicator::after {
    transform: translate(-50%, -50%) scale(1);
}

.nnq-option__text {
    font-size: 1rem;
    color: var(--contrast, #192321);
    line-height: 1.5;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nnq-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--base, #F3F1ED);
}

/* Hide back button on first question (step 1) */
[data-nnq-step="1"] .nnq-navigation [data-nnq-action="back"] {
    visibility: hidden;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.nnq-step--loading .nnq-step__content {
    text-align: center;
    padding: 4rem 2rem;
}

.nnq-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.nnq-loading__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--base, #F3F1ED);
    border-top-color: var(--accent, #95427b);
    border-radius: 50%;
    animation: nnqSpin 0.8s linear infinite;
}

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

.nnq-loading__text {
    font-size: 1.125rem;
    color: var(--contrast-2, #3E4B47);
    margin: 0;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.nnq-error-message {
    text-align: center;
    padding: 2rem 0;
}

.nnq-error-message h3 {
    font-size: 1.25rem;
    color: var(--contrast, #192321);
    margin: 0 0 0.75rem;
}

.nnq-error-message p {
    color: var(--contrast-2, #3E4B47);
    margin: 0 0 1.5rem;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Mobile (up to 480px) */
@media (max-width: 480px) {
    .nnq-quiz {
        padding: 1rem 0.75rem;
    }

    .nnq-step__content {
        padding: 1.5rem 1rem;
        border-radius: 10px;
    }

    .nnq-step__title {
        font-size: 1.5rem;
    }

    .nnq-question__text {
        font-size: 1.25rem;
    }

    .nnq-option__card {
        padding: 0.875rem 1rem;
    }

    .nnq-button {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .nnq-navigation {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .nnq-navigation .nnq-button {
        width: 100%;
    }

    /* Show back button as full width on mobile */
    [data-nnq-step="1"] .nnq-navigation [data-nnq-action="back"] {
        display: none;
    }
}

/* Tablet and up (768px+) */
@media (min-width: 768px) {
    .nnq-quiz {
        padding: 3rem 1.5rem;
    }

    .nnq-step__content {
        padding: 2.5rem;
    }

    .nnq-step__title {
        font-size: 2rem;
    }
}

/* ==========================================================================
   Focus Visible (Keyboard Navigation)
   ========================================================================== */

.nnq-button:focus-visible,
.nnq-option__input:focus-visible + .nnq-option__card,
.nnq-checkbox input:focus-visible + .nnq-checkbox__mark {
    outline: 2px solid var(--accent, #95427b);
    outline-offset: 2px;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .nnq-step,
    .nnq-progress__fill,
    .nnq-option__card,
    .nnq-option__indicator::after,
    .nnq-checkbox__mark::after,
    .nnq-button,
    .nnq-field__input {
        transition: none;
    }

    .nnq-step {
        animation: none;
    }

    .nnq-loading__spinner {
        animation-duration: 1.5s;
    }
}
