/* =========================================
   MAPS | DIAGNÓSTICO DE SAFRA — VISUAL 2.0
   Aesthetic: Orgânico Premium / Campo Refinado
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Variáveis de Design ── */
:root {
    --verde-base: #1e6b2e;
    --verde-medio: #2d8a42;
    --verde-claro: #4caf63;
    --verde-suave: #e8f5eb;
    --verde-mint: #f0faf2;
    --terra: #7a5c2e;
    --dourado: #c8922a;
    --cinza-texto: #2d2d2d;
    --cinza-medio: #6b7280;
    --cinza-borda: #e2e8f0;
    --cinza-bg: #f8fafc;
    --branco: #ffffff;
    --sombra: 0 20px 60px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
    --sombra-card: 0 2px 12px rgba(30, 107, 46, 0.12);
    --raio: 16px;
    --raio-sm: 10px;
    --transicao: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: #0f1f12;
    color: var(--cinza-texto);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
    position: relative;
    overflow-x: hidden;
}

/* ── Textura de fundo ── */
.bg-texture {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 60% at 20% 20%, rgba(44, 122, 44, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 80%, rgba(200, 146, 42, 0.10) 0%, transparent 60%),
        linear-gradient(160deg, #0a1a0d 0%, #122018 40%, #0e1a10 100%);
    z-index: 0;
    pointer-events: none;
}

.bg-texture::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
}

/* ── Container Principal ── */
.container {
    position: relative;
    z-index: 1;
    background: var(--branco);
    max-width: 580px;
    width: 100%;
    border-radius: 24px;
    box-shadow: var(--sombra);
    overflow: hidden;
    animation: entrarCard 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes entrarCard {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Faixa Superior ── */
.top-bar {
    height: 5px;
    background: linear-gradient(90deg, var(--verde-base) 0%, var(--verde-claro) 50%, var(--dourado) 100%);
    position: relative;
    overflow: hidden;
}

.top-bar-accent {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* ── Header ── */
header {
    text-align: center;
    padding: 36px 40px 28px;
    border-bottom: 1px solid var(--cinza-borda);
    background: linear-gradient(180deg, var(--verde-mint) 0%, var(--branco) 100%);
}

.logo-img {
    max-width: 140px;
    height: auto;
    margin-bottom: 12px;
}

.header-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--verde-suave), #d4f0d8);
    color: var(--verde-base);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid rgba(30, 107, 46, 0.2);
    margin-bottom: 12px;
}

header h1 {
    font-family: 'DM Serif Display', Georgia, serif;
    color: var(--verde-base);
    font-size: 28px;
    font-weight: 400;
    line-height: 1.25;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

header h1 em {
    font-style: italic;
    color: var(--dourado);
}

header p {
    color: var(--cinza-medio);
    font-size: 14px;
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto;
}

/* ── Progresso ── */
.progresso-wrapper {
    padding: 20px 40px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progresso-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.texto-progresso {
    font-size: 13px;
    font-weight: 600;
    color: var(--cinza-medio);
}

.percent-progresso {
    font-size: 13px;
    font-weight: 700;
    color: var(--verde-base);
    font-variant-numeric: tabular-nums;
    transition: var(--transicao);
}

.progresso-container {
    width: 100%;
    height: 6px;
    background: var(--cinza-borda);
    border-radius: 100px;
    overflow: hidden;
}

.progresso-barra {
    height: 100%;
    background: linear-gradient(90deg, var(--verde-base), var(--verde-claro));
    border-radius: 100px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progresso-barra::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translate(50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--verde-claro);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 6px rgba(76, 175, 99, 0.5);
    transition: var(--transicao);
    opacity: 0;
}

.progresso-barra.com-progresso::after { opacity: 1; }

.progresso-steps {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding-top: 4px;
}

.step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cinza-borda);
    transition: var(--transicao);
}

.step-dot.ativo { background: var(--verde-base); transform: scale(1.3); }
.step-dot.completo { background: var(--verde-claro); }

/* ── Form ── */
#form-diagnostico {
    padding: 28px 40px 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Passos ── */
.passo {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.passo.ativo {
    display: flex;
    animation: entrarPasso 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.passo.saindo {
    animation: sairPasso 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

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

/* ── Pergunta ── */
.pergunta-grupo {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pergunta-texto {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 17px;
    color: var(--cinza-texto);
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: nowrap;
}

.pergunta-texto .texto-conteudo {
    flex: 1;
    min-width: 0;
}

.pergunta-texto strong {
    font-weight: 700;
    color: var(--cinza-texto);
}

.numero-tag {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--verde-base);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    letter-spacing: 0.03em;
}

/* ── Opções ── */
.opcoes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

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

.opcao {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--cinza-bg);
    border: 2px solid var(--cinza-borda);
    border-radius: var(--raio-sm);
    cursor: pointer;
    text-align: center;
    transition: var(--transicao);
    position: relative;
    min-height: 80px;
}

.opcao:hover {
    border-color: var(--verde-medio);
    background: var(--verde-mint);
    transform: translateY(-2px);
    box-shadow: var(--sombra-card);
}

.opcao:has(input[type="radio"]:checked) {
    background: var(--verde-suave);
    border-color: var(--verde-base);
    color: var(--verde-base);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(30, 107, 46, 0.2);
}

.opcao:has(input[type="radio"]:checked) .opcao-label {
    color: var(--verde-base);
    font-weight: 700;
}

.opcao:has(input[type="radio"]:checked)::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 11px;
    color: var(--verde-base);
    font-weight: 700;
}

.opcao input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.opcao-icon {
    font-size: 24px;
    line-height: 1;
    display: block;
}

.opcao-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--cinza-medio);
    line-height: 1.3;
    transition: var(--transicao);
}

/* ── Inputs ── */
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cinza-medio);
    letter-spacing: 0.02em;
}

.input-texto {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--cinza-borda);
    border-radius: var(--raio-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--cinza-texto);
    background: var(--cinza-bg);
    transition: var(--transicao);
    appearance: none;
    -webkit-appearance: none;
}

.input-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 42px;
    cursor: pointer;
}

.input-texto:focus, .input-texto:focus-visible {
    outline: none;
    border-color: var(--verde-base);
    background: var(--branco);
    box-shadow: 0 0 0 3px rgba(30, 107, 46, 0.1);
}

.input-whatsapp {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-align: center;
}

/* ── Textarea ── */
.textarea-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--cinza-borda);
    border-radius: var(--raio-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--cinza-texto);
    background: var(--cinza-bg);
    resize: vertical;
    min-height: 110px;
    transition: var(--transicao);
    line-height: 1.55;
}

textarea:focus {
    outline: none;
    border-color: var(--verde-base);
    background: var(--branco);
    box-shadow: 0 0 0 3px rgba(30, 107, 46, 0.1);
}

.char-counter {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--cinza-medio);
    background: var(--cinza-bg);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

.char-counter.quase { color: var(--dourado); }
.char-counter.limite { color: #e53e3e; }

.input-hint {
    font-size: 12px;
    color: var(--cinza-medio);
    line-height: 1.5;
}

.privacy-note {
    font-size: 13px;
    color: var(--verde-base);
    font-weight: 500;
    background: var(--verde-mint);
    border: 1px solid rgba(30,107,46,0.15);
    padding: 8px 14px;
    border-radius: 8px;
}

/* ── Navegação ── */
.navegacao-botoes {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

button {
    flex: 1;
    padding: 16px 20px;
    border: none;
    border-radius: var(--raio-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transicao);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

button:active { transform: scale(0.97); }

.btn-primario {
    background: linear-gradient(135deg, var(--verde-base) 0%, var(--verde-medio) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(30, 107, 46, 0.3);
}

.btn-primario:hover {
    background: linear-gradient(135deg, #16541f 0%, var(--verde-base) 100%);
    box-shadow: 0 6px 20px rgba(30, 107, 46, 0.4);
    transform: translateY(-1px);
}

.btn-enviar {
    background: linear-gradient(135deg, var(--terra) 0%, var(--dourado) 100%);
    box-shadow: 0 4px 16px rgba(200, 146, 42, 0.35);
}

.btn-enviar:hover {
    background: linear-gradient(135deg, #5a4020 0%, #b07f20 100%);
    box-shadow: 0 6px 22px rgba(200, 146, 42, 0.45);
    transform: translateY(-1px);
}

.btn-secundario {
    background: var(--cinza-bg);
    color: var(--cinza-medio);
    border: 2px solid var(--cinza-borda);
    flex: 0 0 auto;
    padding: 16px 18px;
    font-size: 14px;
}

.btn-secundario:hover {
    background: var(--cinza-borda);
    color: var(--cinza-texto);
}

button:disabled {
    background: #d1d5db !important;
    color: #9ca3af !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

.oculto { display: none !important; }

/* ── Mensagem Status ── */
#mensagem-status:not(:empty) {
    text-align: center;
    font-weight: 500;
    padding: 16px 20px;
    border-radius: var(--raio-sm);
    font-size: 15px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.sucesso {
    background: var(--verde-suave);
    color: var(--verde-base);
    border: 1px solid rgba(30,107,46,0.2);
}

.erro {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid rgba(197,48,48,0.2);
}

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

/* ── Tela de Sucesso ── */
.sucesso-container {
    text-align: center;
    padding: 20px 0;
    animation: entrarPasso 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.sucesso-icone {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--verde-base), var(--verde-claro));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(30, 107, 46, 0.3);
    animation: pulseIcon 2s ease-in-out infinite;
}

@keyframes pulseIcon {
    0%, 100% { box-shadow: 0 8px 24px rgba(30, 107, 46, 0.3); }
    50% { box-shadow: 0 8px 32px rgba(30, 107, 46, 0.5); }
}

.sucesso-titulo {
    font-family: 'DM Serif Display', serif;
    font-size: 26px;
    color: var(--verde-base);
    margin-bottom: 10px;
}

.sucesso-texto {
    font-size: 15px;
    color: var(--cinza-medio);
    line-height: 1.6;
    margin-bottom: 24px;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

/* ══════════════════════════════════════
   MOBILE — Revisão Completa
   Alvo: 320px–580px
   ══════════════════════════════════════ */
@media (max-width: 580px) {

    /* ── Body e container ── */
    body {
        padding: 0;
        justify-content: flex-start;
        background: var(--branco); /* sem fundo escuro no mobile, card ocupa tela toda */
    }

    .bg-texture { display: none; } /* remove textura decorativa no mobile */

    .container {
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
        min-height: 100dvh; /* dynamic viewport height para iOS Safari */
    }

    /* ── Faixa topo ── */
    .top-bar { height: 4px; }

    /* ── Header ── */
    header {
        padding: 24px 20px 20px;
        background: var(--verde-mint);
    }

    .logo-img { max-width: 110px; margin-bottom: 10px; }

    .header-badge { font-size: 10px; padding: 3px 10px; margin-bottom: 10px; }

    header h1 {
        font-size: 22px;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    header p { font-size: 13px; }

    /* ── Progresso ── */
    .progresso-wrapper {
        padding: 16px 20px 0;
    }

    .texto-progresso { font-size: 12px; }
    .percent-progresso { font-size: 12px; }

    .progresso-container { height: 5px; }

    .step-dot { width: 5px; height: 5px; }

    /* ── Form ── */
    #form-diagnostico {
        padding: 20px 20px 32px;
        gap: 20px;
    }

    /* ── Perguntas ── */
    .pergunta-texto {
        font-size: 16px;
        gap: 10px;
        line-height: 1.4;
    }

    .numero-tag {
        width: 26px;
        height: 26px;
        font-size: 11px;
        border-radius: 7px;
        flex-shrink: 0;
    }

    /* ── Opções: 2 colunas para binário, 1 coluna para 3 opções ── */
    .opcoes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* 3 opções: empilha em coluna única para leitura confortável */
    .opcoes-grid.opcoes-3 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* 3 opções em linha: layout horizontal compacto */
    .opcoes-grid.opcoes-3 .opcao {
        flex-direction: row;
        justify-content: flex-start;
        min-height: 56px;
        padding: 14px 16px;
        gap: 12px;
        text-align: left;
    }

    .opcoes-grid.opcoes-3 .opcao-icon { font-size: 22px; }

    .opcoes-grid.opcoes-3 .opcao-label {
        font-size: 15px;
        font-weight: 500;
    }

    /* Botões de 2 opções: verticais, altura generosa para toque */
    .opcoes-grid:not(.opcoes-3) .opcao {
        flex-direction: column;
        min-height: 80px;
        padding: 14px 10px;
    }

    .opcoes-grid:not(.opcoes-3) .opcao-icon { font-size: 26px; }

    .opcoes-grid:not(.opcoes-3) .opcao-label { font-size: 13px; }

    /* ── Inputs e selects ── */
    .input-row { grid-template-columns: 1fr; gap: 14px; }

    .input-label { font-size: 13px; }

    .input-texto {
        padding: 15px 16px;
        font-size: 16px; /* 16px evita zoom automático no iOS */
        border-radius: 10px;
    }

    .input-select { padding-right: 40px; }

    .input-whatsapp {
        font-size: 20px;
        letter-spacing: 0.04em;
        text-align: center;
        padding: 18px 16px;
    }

    textarea {
        font-size: 16px; /* evita zoom iOS */
        padding: 14px 16px;
        min-height: 100px;
        border-radius: 10px;
    }

    .char-counter { font-size: 10px; }

    .input-hint { font-size: 12px; }

    .privacy-note { font-size: 12px; padding: 8px 12px; }

    /* ── Navegação — botões grandes e acessíveis ── */
    .navegacao-botoes {
        gap: 10px;
        margin-top: 8px;
    }

    .btn-primario {
        padding: 18px 16px;   /* touch target mínimo 48px */
        font-size: 16px;
        border-radius: 12px;
    }

    .btn-secundario {
        padding: 18px 14px;
        font-size: 14px;
        border-radius: 12px;
        flex: 0 0 auto;
        width: auto;
        min-width: 80px;
    }

    /* Botão Enviar: largura total + destaque */
    .btn-enviar {
        font-size: 16px;
        padding: 18px 16px;
        border-radius: 12px;
    }

    /* ── Sucesso ── */
    .sucesso-container { padding: 16px 0; }
    .sucesso-titulo { font-size: 22px; }
    .sucesso-texto { font-size: 14px; }
    .sucesso-icone { width: 64px; height: 64px; font-size: 28px; }
}

/* ── Telas muito pequenas (≤ 360px) ── */
@media (max-width: 360px) {
    header h1 { font-size: 19px; }

    .pergunta-texto { font-size: 15px; }

    .opcoes-grid { gap: 8px; }

    .opcoes-grid:not(.opcoes-3) .opcao { min-height: 72px; }

    .btn-primario, .btn-enviar { padding: 16px 12px; font-size: 15px; }

    .btn-secundario { padding: 16px 10px; font-size: 13px; min-width: 70px; }
}
