/* ============================================================
   K.O. Language Specialists · Modal de contacto previo a WhatsApp
   Diseño alineado con el formulario de contacto del sitio:
   fondo hueso, campos blancos, acento verde y CTA amarillo.
   ============================================================ */

.ko-lead-overlay {
    --ko-green: #6a8069;
    --ko-green-dark: #4d5e4e;
    --ko-yellow: #f8cf41;
    --ko-yellow-dark: #eebf1f;
    --ko-off-white: #f9f7f3;
    --ko-text: #1c2218;
    --ko-muted: #5a6b5b;
    --ko-border: rgba(106, 128, 105, 0.22);

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 28, 18, 0.76);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-family: 'Arimo', Arial, sans-serif;
    color: var(--ko-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.ko-lead-overlay.ko-lead-visible {
    display: flex;
}

.ko-lead-overlay *,
.ko-lead-overlay *::before,
.ko-lead-overlay *::after {
    box-sizing: border-box;
}

body.ko-lead-open {
    overflow: hidden;
}

/* ── Tarjeta ─────────────────────────────────────────────── */

.ko-lead-dialog {
    position: relative;
    width: min(600px, 100%);
    max-height: min(92vh, 820px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--ko-off-white);
    border: 1px solid rgba(106, 128, 105, 0.16);
    border-top: 4px solid var(--ko-yellow);
    border-radius: 16px;
    box-shadow: 0 32px 90px rgba(12, 20, 10, 0.38);
    padding: 34px 36px 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(106, 128, 105, 0.45) transparent;
    animation: koLeadIn 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ko-lead-dialog::-webkit-scrollbar {
    width: 8px;
}

.ko-lead-dialog::-webkit-scrollbar-thumb {
    background: rgba(106, 128, 105, 0.4);
    border-radius: 8px;
}

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

/* ── Cerrar ──────────────────────────────────────────────── */

.ko-lead-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(106, 128, 105, 0.2);
    border-radius: 50%;
    background: #ffffff;
    color: var(--ko-green-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
        transform 0.2s ease;
}

.ko-lead-close:hover {
    background: var(--ko-yellow);
    border-color: var(--ko-yellow);
    color: var(--ko-text);
    transform: rotate(90deg);
}

.ko-lead-close:focus-visible {
    outline: 2px solid var(--ko-green);
    outline-offset: 2px;
}

.ko-lead-close svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* ── Encabezado ──────────────────────────────────────────── */

.ko-lead-head {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding-right: 46px;
    margin: 0 0 24px;
}

.ko-lead-badge {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ko-green);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(106, 128, 105, 0.28);
}

.ko-lead-badge svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.ko-lead-kicker {
    display: block;
    margin: 1px 0 5px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ko-green);
}

.ko-lead-head h2 {
    margin: 0 0 9px;
    font-family: 'Archivo Black', 'Arimo', Arial, sans-serif;
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -0.01em;
    color: var(--ko-text);
}

.ko-lead-head h2 em {
    font-family: 'Arimo', Arial, sans-serif;
    font-style: italic;
    font-weight: 300;
    color: var(--ko-green);
}

.ko-lead-head p {
    margin: 0;
    font-size: 13px;
    font-weight: 300;
    line-height: 1.7;
    color: var(--ko-muted);
}

/* ── Formulario ──────────────────────────────────────────── */

.ko-lead-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
}

.ko-lead-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ko-lead-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    min-width: 0;
}

.ko-lead-field > span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ko-muted);
}

.ko-lead-field > span b {
    color: var(--ko-green-dark);
    font-weight: 500;
}

.ko-lead-field input,
.ko-lead-field select,
.ko-lead-field textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--ko-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ko-text);
    font-family: 'Arimo', Arial, sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.4;
    padding: 0 16px;
    height: 46px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ko-lead-field textarea {
    height: auto;
    min-height: 110px;
    padding: 12px 16px;
    resize: vertical;
}

.ko-lead-field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a6b5b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

.ko-lead-field select:invalid {
    color: #9aa598;
}

.ko-lead-field select option {
    color: var(--ko-text);
}

.ko-lead-field input::placeholder,
.ko-lead-field textarea::placeholder {
    color: #9aa598;
    font-weight: 300;
}

.ko-lead-field input:hover,
.ko-lead-field select:hover,
.ko-lead-field textarea:hover {
    border-color: rgba(106, 128, 105, 0.4);
}

.ko-lead-field input:focus,
.ko-lead-field select:focus,
.ko-lead-field textarea:focus {
    border-color: var(--ko-green);
    box-shadow: 0 0 0 3px rgba(106, 128, 105, 0.14);
}

/* ── Privacidad ──────────────────────────────────────────── */

.ko-lead-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 300;
    line-height: 1.55;
    color: var(--ko-muted);
    cursor: pointer;
}

.ko-lead-check input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--ko-green);
    cursor: pointer;
}

/* ── Honeypot ────────────────────────────────────────────── */

.ko-lead-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ── Error ───────────────────────────────────────────────── */

.ko-lead-error {
    display: none;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid rgba(185, 28, 28, 0.16);
    border-left: 3px solid #b91c1c;
    border-radius: 8px;
    background: #fdf3f2;
    color: #991b1b;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.55;
}

.ko-lead-error.ko-visible {
    display: block;
}

/* ── Acciones ────────────────────────────────────────────── */

.ko-lead-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
}

/* ── Botón ───────────────────────────────────────────────── */

.ko-lead-submit {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 2px 0 0;
    border: none;
    border-radius: 8px;
    background: var(--ko-yellow);
    color: var(--ko-text);
    font-family: 'Arimo', Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ko-lead-submit:hover {
    background: var(--ko-yellow-dark);
    box-shadow: 0 10px 24px rgba(248, 207, 65, 0.35);
    transform: translateY(-1px);
}

.ko-lead-submit:focus-visible {
    outline: 2px solid var(--ko-green);
    outline-offset: 2px;
}

.ko-lead-submit:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.ko-lead-submit svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Nota ────────────────────────────────────────────────── */

.ko-lead-note {
    margin: 0;
    font-size: 11px;
    font-weight: 300;
    line-height: 1.6;
    color: #8a9588;
    text-align: center;
}

/* ── Móvil: hoja inferior ────────────────────────────────── */

@media (max-width: 640px) {
    .ko-lead-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .ko-lead-dialog {
        width: 100%;
        max-height: 94vh;
        max-height: 94dvh;
        border-radius: 18px 18px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        padding: 26px 20px 0;
    }

    .ko-lead-head {
        gap: 12px;
        padding-right: 42px;
        margin-bottom: 16px;
    }

    .ko-lead-head p {
        font-size: 12px;
        line-height: 1.6;
    }

    .ko-lead-badge {
        width: 40px;
        height: 40px;
    }

    .ko-lead-badge svg {
        width: 21px;
        height: 21px;
    }

    .ko-lead-head h2 {
        font-size: 21px;
    }

    .ko-lead-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ko-lead-form {
        gap: 12px;
    }

    .ko-lead-field {
        gap: 5px;
    }

    .ko-lead-field input,
    .ko-lead-field select {
        height: 44px;
    }

    .ko-lead-field textarea {
        min-height: 88px;
    }

    .ko-lead-check {
        font-size: 11.5px;
    }

    .ko-lead-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin: 0 -20px;
        padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
        background: var(--ko-off-white);
    }

    .ko-lead-actions::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -18px;
        height: 18px;
        background: linear-gradient(to top, var(--ko-off-white), rgba(249, 247, 243, 0));
        pointer-events: none;
    }

    .ko-lead-submit {
        min-height: 48px;
        margin-top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ko-lead-dialog {
        animation: none;
    }

    .ko-lead-close:hover,
    .ko-lead-submit:hover {
        transform: none;
    }
}
