/* ============================================================
   WhatsApp Form Interceptor — Modal Styles
   ============================================================ */

:root {
    --wafi-brand:       #2E7D32;
    --wafi-brand-hover: #1B5E20;
    --wafi-radius:      16px;
    --wafi-shadow:      0 8px 40px rgba(0,0,0,.22);
    --wafi-font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --wafi-z:           999999;
    --wafi-anim:        .25s cubic-bezier(.4,0,.2,1);
}

/* ── Overlay ──────────────────────────────── */
.wafi-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: var(--wafi-z);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 24px 90px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity var(--wafi-anim);
    font-family: var(--wafi-font);
}
.wafi-overlay.wafi-visible {
    opacity: 1;
}
.wafi-overlay[hidden] {
    display: none !important;
}
.wafi-overlay.wafi-position-left {
    justify-content: flex-start;
    padding: 0 0 90px 24px;
}

/* ── Modal card ───────────────────────────── */
.wafi-modal {
    background: #fff;
    border-radius: var(--wafi-radius);
    box-shadow: var(--wafi-shadow);
    width: 340px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    transform: translateY(20px) scale(.97);
    transition: transform var(--wafi-anim);
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
.wafi-overlay.wafi-visible .wafi-modal {
    transform: translateY(0) scale(1);
}

/* ── Header ───────────────────────────────── */
.wafi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--wafi-brand);
    color: #fff;
}
.wafi-header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.wafi-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.3);
}
.wafi-logo-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.wafi-logo-placeholder svg {
    width: 26px;
    height: 26px;
}
.wafi-logo-placeholder.sm {
    width: 34px;
    height: 34px;
}
.wafi-logo-placeholder.sm svg {
    width: 20px;
    height: 20px;
}
.wafi-header__text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}
.wafi-header__text span {
    font-size: 12px;
    opacity: .85;
}
.wafi-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    opacity: .8;
    transition: opacity .15s, background .15s;
    flex-shrink: 0;
}
.wafi-close:hover {
    opacity: 1;
    background: rgba(255,255,255,.15);
}

/* ── Chat bubble ──────────────────────────── */
.wafi-bubble-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 16px 16px 4px;
    background: #e5ddd5;  /* classic WA background */
}
.wafi-bubble-avatar {
    flex-shrink: 0;
}
.wafi-bubble-avatar img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}
.wafi-bubble {
    background: #fff;
    border-radius: 12px 12px 12px 2px;
    padding: 10px 14px;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    max-width: calc(100% - 50px);
}

/* ── Form wrapper ─────────────────────────── */
.wafi-form-wrap {
    padding: 16px 16px 70px;
    background: #f0f0f0;
}

/* Reset WPForms inside modal */
.wafi-form-wrap .wpforms-container {
    margin: 0 !important;
    padding: 0 !important;
}
.wafi-form-wrap .wpforms-form {
    background: transparent !important;
    padding: 0 !important;
}
.wafi-form-wrap .wpforms-field {
    padding: 0 !important;
    margin-bottom: 10px !important;
}
.wafi-form-wrap .wpforms-field input,
.wafi-form-wrap .wpforms-field textarea,
.wafi-form-wrap .wpforms-field select {
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: #fff !important;
    color: #333 !important;
    transition: border-color .2s !important;
    box-shadow: none !important;
}
.wafi-form-wrap .wpforms-field input:focus,
.wafi-form-wrap .wpforms-field textarea:focus {
    border-color: var(--wafi-brand) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wafi-brand) 15%, transparent) !important;
}
.wafi-form-wrap .wpforms-field label,
.wafi-form-wrap .wpforms-field .wpforms-label-hide {
    display: none !important;
}
.wafi-form-wrap .wpforms-field input::placeholder,
.wafi-form-wrap .wpforms-field textarea::placeholder {
    color: #999 !important;
}

/* Submit button */
.wafi-form-wrap .wpforms-submit-container {
    padding: 0 !important;
    margin: 4px 0 0 !important;
    text-align: center !important;
}
.wafi-form-wrap .wpforms-submit,
.wafi-form-wrap button[type="submit"] {
    background: var(--wafi-brand) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 24px !important;
    padding: 11px 32px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    width: 100% !important;
    transition: background .2s, transform .1s !important;
    letter-spacing: .3px !important;
}
.wafi-form-wrap .wpforms-submit:hover,
.wafi-form-wrap button[type="submit"]:hover {
    background: var(--wafi-brand-hover) !important;
    transform: translateY(-1px) !important;
}
.wafi-form-wrap .wpforms-submit:active {
    transform: translateY(0) !important;
}

/* Hide WPForms' own confirmation msg; we show ours */
.wafi-form-wrap .wpforms-confirmation-container {
    display: none !important;
}
/* Hide errors that look weird in modal */
.wafi-form-wrap .wpforms-error-container {
    border-radius: 8px !important;
    font-size: 13px !important;
}

/* ── Success state ────────────────────────── */
.wafi-success {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    gap: 12px;
    background: #f9f9f9;
}
.wafi-success[hidden] {
    display: none !important;
}
.wafi-success svg {
    width: 56px;
    height: 56px;
}
.wafi-success p {
    margin: 0;
    font-size: 15px;
    color: var(--wafi-brand);
    font-weight: 600;
}

/* ── Phone flag (WPForms smart phone) ─────── */
.wafi-form-wrap .wpforms-smart-phone-field {
    display: flex !important;
}

/* ── reCAPTCHA container ──────────────────── */
.wafi-form-wrap .g-recaptcha {
    transform: scale(.88);
    transform-origin: left center;
    margin-bottom: 8px;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 480px) {
    .wafi-overlay {
        padding: 0 12px 80px;
        align-items: flex-end;
        justify-content: center;
    }
    .wafi-modal {
        width: 100%;
        max-width: 100%;
        border-radius: var(--wafi-radius) var(--wafi-radius) 0 0;
        transform: translateY(40px);
    }
    .wafi-overlay.wafi-visible .wafi-modal {
        transform: translateY(0);
    }
}
/* Fix botón cerrar modal WAFI */
.wafi-close {
    background: #e53935 !important;
    border: none !important;
    border-radius: 50% !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background .15s !important;
    margin-top: -40px;
}
.wafi-close:hover {
    background: #c62828 !important;
    opacity: 1 !important;
}