/* ==========================================================================
   SERIUM LEAD MODAL — Componente de Intermediação de Contato
   Design System: Terra & Sálvia / Acessibilidade WCAG 2.1 AA
   ========================================================================== */

.slm-modal {
    position: fixed;
    top: var(--slm-vvt, 0);
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: var(--slm-vvh, 100dvh);
    bottom: auto;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 24, 20, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.slm-modal[hidden] {
    display: none !important;
    opacity: 0;
}

body.slm-open {
    overflow: hidden;
}

.slm-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface, #FFFFFF);
    border-radius: var(--radius-lg, 20px);
    border: 1px solid rgba(214, 207, 199, 0.4);
    box-shadow: 0 20px 48px rgba(43, 36, 32, 0.22);
    padding: 32px 28px;
    box-sizing: border-box;
    animation: slmSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.slm-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted, #716658);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.slm-close:hover,
.slm-close:focus-visible {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text, #2B2420);
    outline: none;
}

.slm-close svg {
    width: 20px;
    height: 20px;
}

.slm-header {
    margin-bottom: 24px;
    padding-right: 28px;
}

.slm-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1b633a;
    background: #eef7f1;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.slm-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.slm-title {
    font-family: var(--font-heading, serif);
    font-size: 22px;
    line-height: 1.25;
    color: var(--text, #2B2420);
    margin: 0 0 8px 0;
}

.slm-subtitle {
    font-family: var(--font-body, sans-serif);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted, #716658);
    margin: 0;
}

.slm-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.slm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slm-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    margin: 0;
    color: var(--text, #2B2420);
}

.slm-input {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid var(--border, #D6CFC7);
    border-radius: 12px;
    background: #FAF8F5;
    color: var(--text, #2B2420);
    box-sizing: border-box;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.slm-input:focus {
    outline: none;
    border-color: var(--primary, #5C4B40);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(92, 75, 64, 0.12);
}

.slm-radios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.slm-radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 12px;
    margin: 0;
    border: 1px solid var(--border, #D6CFC7);
    border-radius: 12px;
    background: #FAF8F5;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text, #2B2420);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slm-radio-label:has(input:checked) {
    border-color: #25D366;
    background: #F0FDF4;
    color: #166534;
    font-weight: 600;
}

.slm-radio-label input {
    accent-color: #25D366;
}

.slm-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-size: 12px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-muted, #716658);
}

.slm-consent input {
    margin-top: 2px;
    accent-color: var(--primary, #5C4B40);
    flex-shrink: 0;
}

.slm-error {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.slm-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    background: #25D366;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
    transition: background-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.slm-submit:hover:not(:disabled) {
    background: #20BD5A;
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
    transform: translateY(-1px);
}

.slm-submit:active:not(:disabled) {
    transform: translateY(0);
}

.slm-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.slm-submit svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Responsividade Mobile — modal contido na tela com 10px de respiro */
@media (max-width: 640px) {
    .slm-modal {
        padding: 10px;
        align-items: center;
    }

    .slm-dialog {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: var(--m-radius-md, 16px);
        padding: 20px 18px;
    }

    .slm-close {
        top: 12px;
        right: 12px;
    }

    .slm-header {
        margin-bottom: 16px;
        padding-right: 26px;
    }

    .slm-badge {
        font-size: 11px;
        margin-bottom: 8px;
    }

    .slm-title { font-size: 19px !important; }
    .slm-subtitle { font-size: 13px; line-height: 1.45; }
    .slm-form { gap: 14px; }
    .slm-input { padding: 12px 14px; font-size: 16px; }
    .slm-radio-label { padding: 10px; }
    .slm-consent { font-size: 12px; }
    .slm-submit { padding: 14px 16px; font-size: 15px; }
}

/* Telas curtas: compacta para caber sem rolagem */
@media (max-width: 640px) and (max-height: 720px) {
    .slm-dialog { padding: 16px; }
    .slm-header { margin-bottom: 12px; }
    .slm-badge { display: none; }
    .slm-title { font-size: 17px !important; }
    .slm-subtitle { font-size: 12px; }
    .slm-form { gap: 10px; }
    .slm-field { gap: 4px; }
    .slm-input { padding: 10px 12px; }
    .slm-radio-label { padding: 8px; }
    .slm-consent { font-size: 11px; line-height: 1.4; }
    .slm-submit { padding: 12px 14px; }
    /* Sem barra visível: o conteúdo continua rolável por toque se precisar. */
    .slm-dialog { scrollbar-width: none; }
    .slm-dialog::-webkit-scrollbar { width: 0; height: 0; }
}

/* Teclado aberto (altura visível pequena): modo mais compacto */
@media (max-width: 640px) and (max-height: 520px) {
    .slm-modal { padding: 8px; }
    .slm-dialog { padding: 10px; }
    .slm-header { margin-bottom: 6px; }
    .slm-subtitle { display: none; }
    .slm-title { font-size: 15px !important; }
    .slm-form { gap: 7px; }
    .slm-input { padding: 7px 10px; }
    .slm-radio-label { padding: 7px; font-size: 13px; }
    .slm-consent { font-size: 10px; line-height: 1.35; }
    .slm-submit { padding: 10px 12px; font-size: 14px; }
}
