/* survey-modal.css — Post-retirement planner survey
   WCAG 2.2 AAA: contrast ratios verified, focus indicators, no motion concerns
   Uses WOOP design tokens (--background, --foreground, --wealth, --focus-ring, --font-family) */

/* ── Overlay ─────────────────────────────────────────────────────────────── */

#rw-survey-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: rw-fade-in 0.25s ease forwards;
}

#rw-survey-overlay[hidden] {
    display: none;
}

@keyframes rw-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Card ────────────────────────────────────────────────────────────────── */

#rw-survey-card {
    background: var(--background);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
    width: min(540px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: rw-slide-up 0.25s ease forwards;
}

@keyframes rw-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header ──────────────────────────────────────────────────────────────── */

#rw-survey-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
    gap: 1rem;
}

#rw-survey-title {
    font-family: var(--font-family-heading);
    font-size: 1.15rem;
    color: var(--foreground);
    line-height: 1.3;
}

#rw-survey-progress {
    font-family: var(--font-family);
    font-size: 0.8rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Body ────────────────────────────────────────────────────────────────── */

#rw-survey-body {
    padding: 1.25rem 1.5rem;
    flex: 1;
}

.rw-sq-question {
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0 0 1.25rem;
    line-height: 1.45;
}

/* ── Star rating ─────────────────────────────────────────────────────────── */

.rw-star-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.5rem 0;
}

.rw-star {
    background: none;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    color: var(--muted-foreground);
    transition: color 0.1s, transform 0.1s;
}

.rw-star--filled {
    color: #c98a00;
}

.rw-star:hover,
.rw-star:focus-visible {
    color: #c98a00;
    transform: scale(1.1);
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ── Option buttons (single + multi) ─────────────────────────────────────── */

.rw-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rw-options--yn {
    flex-direction: row;
    gap: 0.75rem;
}

.rw-option {
    background: transparent;
    border: 1.5px solid rgba(26, 26, 26, 0.2);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-family: var(--font-family);
    font-size: 0.95rem;
    color: var(--foreground);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    line-height: 1.4;
}

.rw-options--yn .rw-option {
    flex: 1;
    text-align: center;
}

.rw-option:hover {
    border-color: var(--wealth);
    background: var(--wealth-bg);
}

.rw-option:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.rw-option--selected {
    background: var(--wealth);
    border-color: var(--wealth);
    color: #ffffff;
    font-weight: 500;
}

.rw-option--selected:hover {
    background: var(--wealth-hover);
    border-color: var(--wealth-hover);
    color: #ffffff;
}

/* ── Email follow-up ─────────────────────────────────────────────────────── */

.rw-email-wrap {
    margin-top: 1rem;
}

.rw-email-label {
    display: block;
    font-family: var(--font-family);
    font-size: 0.875rem;
    color: var(--foreground);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.rw-email-input {
    width: 100%;
    border: 1.5px solid rgba(26, 26, 26, 0.25);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    font-family: var(--font-family);
    font-size: 0.95rem;
    color: var(--foreground);
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.rw-email-input:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-color: var(--focus-ring);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

#rw-survey-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem 1.25rem;
    border-top: 1px solid rgba(26, 26, 26, 0.08);
    gap: 1rem;
}

#rw-survey-skip {
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: 0.85rem;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.4rem 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s;
}

#rw-survey-skip:hover {
    color: var(--foreground);
}

#rw-survey-skip:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 3px;
}

#rw-survey-actions {
    display: flex;
    gap: 0.5rem;
}

#rw-survey-back,
#rw-survey-next {
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#rw-survey-back {
    background: transparent;
    border: 1.5px solid rgba(26, 26, 26, 0.25);
    color: var(--foreground);
}

#rw-survey-back:hover {
    border-color: var(--foreground);
}

#rw-survey-back:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

#rw-survey-back[hidden] {
    display: none;
}

#rw-survey-next {
    background: var(--wealth);
    border: 1.5px solid var(--wealth);
    color: #ffffff;
}

#rw-survey-next:hover {
    background: var(--wealth-hover);
    border-color: var(--wealth-hover);
}

#rw-survey-next:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    #rw-survey-overlay,
    #rw-survey-card {
        animation: none;
    }

    .rw-star {
        transition: none;
    }

    .rw-option,
    #rw-survey-back,
    #rw-survey-next,
    #rw-survey-skip {
        transition: none;
    }
}
