/* ============================================================
   Design Tokens
   ============================================================ */
:root {
    --bg-primary:   #801627;
    --bg-secondary: #8E192B;
    --bg-deep:      #4A0B14;

    --text:         #FFEFCF;
    --text-muted:   rgba(255, 239, 207, 0.55);
    --text-dim:     rgba(255, 239, 207, 0.35);

    --gold:         #D4A843;
    --gold-dark:    #A87828;
    --gold-glow:    rgba(212, 168, 67, 0.22);

    --glass-brand:  rgba(50, 4, 12, 0.52);
    --glass-form:   rgba(12, 2, 5, 0.48);
    --glass-block:  rgba(255, 239, 207, 0.04);
    --glass-input:  rgba(255, 239, 207, 0.05);
    --glass-choice: rgba(255, 239, 207, 0.04);

    --border:       rgba(255, 239, 207, 0.1);
    --border-hover: rgba(255, 239, 207, 0.22);
    --border-focus: rgba(212, 168, 67, 0.55);

    --success:      #3DAB75;
    --success-bg:   rgba(61, 171, 117, 0.12);
    --error:        #FF6B6B;
    --error-bg:     rgba(255, 107, 107, 0.12);

    --shadow:       0 40px 100px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 239, 207, 0.06);
    --shadow-btn:   0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(212, 168, 67, 0.2);

    --font: "Manrope", sans-serif;

    /* Type scale */
    --fs-xs:      0.7rem;    /* eyebrows, question numbers, micro labels */
    --fs-sm:      0.8rem;    /* hints, footnotes, table headers, pills */
    --fs-md:      0.9rem;    /* form labels, choice options, alerts */
    --fs-base:    1rem;      /* body, inputs, buttons */
    --fs-lg:      1.125rem;  /* minor sub-headings */
    --fs-xl:      1.3rem;    /* section headings (h2) */
    --fs-2xl:     clamp(1.9rem, 3.2vw, 3rem);   /* page h1 — brand panel desktop */
    --fs-display: clamp(2rem, 4vw, 2.8rem);     /* stat / display numbers */

    --radius-card:  20px;
    --radius-block: 16px;
    --radius-input: 12px;
    --radius-pill:  999px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: var(--font);
    font-size: var(--fs-base);
    color: var(--text);
    background:
        radial-gradient(ellipse 70% 55% at 15% 10%, rgba(255, 239, 207, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse 55% 45% at 85% 90%, rgba(0, 0, 0, 0.35) 0%, transparent 55%),
        linear-gradient(150deg, var(--bg-primary) 0%, var(--bg-secondary) 55%, var(--bg-deep) 100%);
    background-attachment: fixed;
}

/* ============================================================
   Layout — MOBILE FIRST (padrão)
   ============================================================ */
.page-shell {
    padding: 0;
    min-height: 100vh;
}

.survey-card {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

/* ============================================================
   Painel da marca — MOBILE: header horizontal compacto
   ============================================================ */
.brand-panel {
    position: relative;
    overflow: hidden;
    background: var(--glass-brand);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.brand-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    height: auto;
}

.brand-logo {
    width: 52px;
    min-width: 52px;
    filter: drop-shadow(0 2px 8px rgba(212, 168, 67, 0.25));
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: var(--fs-xs);
    font-weight: 800;
    color: var(--gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-inner h1 {
    font-size: var(--fs-base);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Ocultos no mobile */
.lead,
.pill-list,
.brand-divider,
.brand-footnote,
.brand-orb {
    display: none;
}

/* ============================================================
   Painel do formulário — MOBILE
   ============================================================ */
.form-panel {
    background: var(--glass-form);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 20px 16px 32px;
}

/* ============================================================
   Alerta de status
   ============================================================ */
.form-alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-block);
    font-size: var(--fs-md);
    font-weight: 700;
    line-height: 1.55;
    border: 1px solid transparent;
}

.form-alert.success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(61, 171, 117, 0.25);
}

.form-alert.error {
    background: var(--error-bg);
    color: var(--error);
    border-color: rgba(255, 107, 107, 0.25);
}

/* ============================================================
   Formulário
   ============================================================ */
#surveyForm {
    display: grid;
    gap: 12px;
}

.question-block {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-radius: var(--radius-block);
    border: 1px solid var(--border);
    background: var(--glass-block);
    transition: border-color 0.2s ease;
}

.question-block:focus-within {
    border-color: var(--border-hover);
}

.question-number {
    display: inline-block;
    flex: 0 0 auto;
    font-size: var(--fs-xs);
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.06em;
    margin-right: 0;
    margin-top: 0.2rem;
}

.question-block label,
.question-block legend {
    font-size: var(--fs-md);
    font-weight: 700;
    line-height: 1.5;
    color: var(--text);
}

.question-block > label,
.question-block > legend,
.question-heading {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.question-block > legend {
    width: 100%;
    min-width: 0;
    padding: 0;
}

.question-title {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.question-heading {
    margin: 0;
    font-size: var(--fs-md);
    font-weight: 700;
    line-height: 1.5;
    color: var(--text);
}

/* Inputs */
.question-block input[type="text"],
.question-block select,
.question-block input[type="date"],
.question-block textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 13px 14px;
    font: inherit;
    font-size: var(--fs-base); /* var(--fs-base) previne zoom automático no iOS */
    color: var(--text);
    background: var(--glass-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.question-block input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8) sepia(0.3);
    opacity: 0.6;
    cursor: pointer;
}

.question-block select {
    cursor: pointer;
}

.question-block select option {
    color: var(--text);
    background: #5f1720;
}

.question-block select option[value=""] {
    color: var(--text-muted);
}

.question-block input::placeholder,
.question-block textarea::placeholder {
    color: var(--text-dim);
}

.question-block input:focus,
.question-block textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.question-block textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.65;
}

.field-hint {
    color: var(--text-dim);
    font-size: var(--fs-sm);
}

/* ============================================================
   Grade de opções (radio)
   ============================================================ */
.choice-grid {
    display: grid;
    gap: 8px;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.score-option {
    position: relative;
    display: block;
}

.score-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.score-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--glass-choice);
    color: var(--text-muted);
    font-weight: 800;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.score-option input:checked + span {
    border-color: var(--border-focus);
    background: rgba(212, 168, 67, 0.14);
    color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

.choice-grid--3 {
    grid-template-columns: 1fr;
}

.choice-grid label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    background: var(--glass-choice);
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    user-select: none;
    /* Área de toque confortável no mobile */
    min-height: 48px;
}

.choice-grid label:active {
    background: rgba(255, 239, 207, 0.07);
    border-color: var(--border-hover);
}

.choice-grid label:has(input:checked) {
    border-color: var(--border-focus);
    background: rgba(212, 168, 67, 0.1);
    color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

.choice-grid input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-hover);
    background: transparent;
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.choice-grid input[type="radio"]:checked {
    border-color: var(--gold);
    background: radial-gradient(circle, var(--gold) 40%, transparent 40%);
}

/* ============================================================
   Botão de envio
   ============================================================ */
.submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    border: none;
    border-radius: var(--radius-block);
    padding: 16px 24px;
    font: inherit;
    font-size: var(--fs-base);
    font-weight: 800;
    color: #1A0808;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    box-shadow: var(--shadow-btn);
    cursor: pointer;
    /* Área de toque mínima para mobile */
    min-height: 52px;
    transition: filter 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.submit-button:active {
    filter: brightness(0.92);
    transform: scale(0.99);
}

/* ============================================================
   Tablet — 480px+
   ============================================================ */
@media (min-width: 480px) {
    .brand-inner {
        padding: 18px 24px;
        gap: 16px;
    }

    .brand-logo {
        width: 60px;
        min-width: 60px;
    }

    .brand-inner h1 {
        font-size: var(--fs-lg);
    }

    .form-panel {
        padding: 24px 24px 40px;
    }

    #surveyForm {
        gap: 14px;
    }

    .score-grid {
        grid-template-columns: repeat(11, minmax(0, 1fr));
    }
}

/* ============================================================
   Desktop — 960px+: layout dois painéis
   ============================================================ */
@media (min-width: 960px) {
    .page-shell {
        padding: 28px 20px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }

    .survey-card {
        max-width: 1160px;
        grid-template-columns: 0.9fr 1.25fr;
        border-radius: var(--radius-card);
        box-shadow: var(--shadow);
        border: 1px solid rgba(255, 239, 207, 0.07);
    }

    /* --- Painel da marca: sticky, vertical, completo --- */
    .brand-panel {
        position: sticky;
        top: 0;
        height: 100vh;
        border-bottom: none;
        border-right: 1px solid var(--border);
    }

    .brand-inner {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding: 52px 44px;
        height: 100%;
        gap: 0;
    }

    .brand-logo {
        width: 140px;
        min-width: 140px;
        margin-bottom: 32px;
    }

    .brand-text {
        gap: 10px;
    }

    .eyebrow {
        letter-spacing: 0.22em;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        margin-bottom: 0;
    }

    .brand-inner h1 {
        font-size: var(--fs-2xl);
        line-height: 1.08;
        letter-spacing: -0.02em;
    }

    /* Revelar elementos ocultos no mobile */
    .lead {
        display: block;
        margin-top: 18px;
        font-size: var(--fs-base);
        line-height: 1.75;
        color: var(--text-muted);
        max-width: 380px;
    }

    .pill-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 30px;
    }

    .brand-divider {
        display: block;
        width: 48px;
        height: 1px;
        background: linear-gradient(90deg, var(--gold), transparent);
        margin: 32px 0 18px;
        opacity: 0.5;
    }

    .brand-footnote {
        display: block;
        font-size: var(--fs-sm);
        color: var(--text-dim);
        font-weight: 600;
        letter-spacing: 0.06em;
    }

    .brand-orb {
        display: block;
        position: absolute;
        border-radius: 50%;
        pointer-events: none;
    }

    .brand-orb--1 {
        width: 340px;
        height: 340px;
        top: -100px;
        right: -120px;
        background: radial-gradient(circle, rgba(212, 168, 67, 0.08) 0%, transparent 65%);
    }

    .brand-orb--2 {
        width: 260px;
        height: 260px;
        bottom: -80px;
        left: -60px;
        background: radial-gradient(circle, rgba(255, 239, 207, 0.04) 0%, transparent 65%);
    }

    .choice-grid--3 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* --- Painel do formulário: desktop --- */
    .form-panel {
        padding: 44px 36px;
    }

    #surveyForm {
        gap: 16px;
    }

    .question-block {
        padding: 20px;
    }

    /* Hover states — só no desktop (evita stuck hover no touch) */
    .choice-grid label:hover {
        background: rgba(255, 239, 207, 0.07);
        border-color: var(--border-hover);
        color: var(--text);
        transform: translateY(-1px);
    }

    .score-option:hover span {
        background: rgba(255, 239, 207, 0.07);
        border-color: var(--border-hover);
        color: var(--text);
        transform: translateY(-1px);
    }

    .submit-button:hover {
        filter: brightness(1.08);
        transform: translateY(-2px);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 168, 67, 0.35);
    }

    .submit-button:active {
        transform: translateY(0) scale(1);
        filter: brightness(0.96);
    }

    .question-block input:focus,
    .question-block textarea:focus {
        transform: translateY(-1px);
    }
}

/* ============================================================
   Pills (compartilhado entre mobile mini e desktop)
   ============================================================ */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(212, 168, 67, 0.28);
    background: rgba(212, 168, 67, 0.08);
    color: var(--gold);
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.01em;
}
