/* ═══════════════════════════════════════════════════════════════════
   WF WhatsApp Forms — Public CSS v1.1
   Compatible con Materialize CSS / standalone
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --wf-accent:     #25D366;
    --wf-radius:     12px;
    --wf-shadow:     0 20px 60px rgba(0,0,0,.35);
    --wf-transition: .25s cubic-bezier(.4,0,.2,1);
    --wf-overlay-bg: rgba(0,0,0,.6);
    --wf-btn-radius: 20px; /* radio de bordes para modo botones (overridden inline) */
}

/* ── Trigger button (shortcode) ─────────────────────────────────── */

.wf-waf-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--wf-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter var(--wf-transition), transform var(--wf-transition);
    text-decoration: none;
    letter-spacing: .02em;
}
.wf-waf-trigger-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: #fff;
}
.wf-waf-trigger-btn:active { transform: translateY(0); }

/* ── Overlay ─────────────────────────────────────────────────────── */

.wf-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--wf-overlay-bg);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
}

/* Animación slide */
.wf-anim-slide .wf-popup-modal {
    transform: translateY(40px);
    opacity: 0;
    transition: transform var(--wf-transition), opacity var(--wf-transition);
}
.wf-anim-slide.wf-popup-open .wf-popup-modal { transform: translateY(0); opacity: 1; }

/* Animación fade */
.wf-anim-fade .wf-popup-modal {
    opacity: 0; transform: scale(.96);
    transition: opacity var(--wf-transition), transform var(--wf-transition);
}
.wf-anim-fade.wf-popup-open .wf-popup-modal { opacity: 1; transform: scale(1); }

/* ── Modal ───────────────────────────────────────────────────────── */

.wf-popup-modal {
    background: #fff;
    border-radius: var(--wf-radius);
    box-shadow: var(--wf-shadow);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 600px) {
    .wf-popup-overlay { padding: 0; align-items: flex-end; }
    .wf-popup-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--wf-radius) var(--wf-radius) 0 0;
    }
    .wf-anim-slide .wf-popup-modal  { transform: translateY(100%); }
    .wf-anim-slide.wf-popup-open .wf-popup-modal { transform: translateY(0); }
}

/* ── Header ──────────────────────────────────────────────────────── */

.wf-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: #fff;
    flex-shrink: 0;
}
.wf-popup-title { font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.wf-popup-close {
    background: rgba(255,255,255,.2);
    border: none; color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%; font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s; flex-shrink: 0; line-height: 1;
}
.wf-popup-close:hover { background: rgba(255,255,255,.35); }

/* ── Body ────────────────────────────────────────────────────────── */

.wf-popup-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.wf-popup-description { font-size: 14px; color: #666; margin: 0 0 16px; line-height: 1.6; }

/* ── Fields grid ─────────────────────────────────────────────────── */

.wf-fields-grid { display: flex; flex-wrap: wrap; gap: 12px; }

.wf-fw-100 { flex: 0 0 100%; }
.wf-fw-75  { flex: 0 0 calc(75% - 6px); }
.wf-fw-66  { flex: 0 0 calc(66.666% - 6px); }
.wf-fw-50  { flex: 0 0 calc(50% - 6px); }
.wf-fw-33  { flex: 0 0 calc(33.333% - 6px); }
.wf-fw-25  { flex: 0 0 calc(25% - 6px); }

@media (max-width: 480px) {
    .wf-fw-75, .wf-fw-66, .wf-fw-50, .wf-fw-33, .wf-fw-25 { flex: 0 0 100%; }
}

/* ── Input styles (Materialize-compatible) ───────────────────────── */

.wf-input-wrap { display: flex; flex-direction: column; width: 100%; }

.wf-input-wrap label {
    font-size: 12px; font-weight: 600;
    color: #888; margin-bottom: 4px; letter-spacing: .01em;
}

.wf-input-wrap input,
.wf-input-wrap select,
.wf-input-wrap textarea {
    width: 100%;
    border: none;
    border-bottom: 2px solid #ddd;
    border-radius: 0;
    padding: 8px 2px;
    font-size: 15px;
    color: #333;
    background: transparent;
    box-sizing: border-box;
    transition: border-color .2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

.wf-input-wrap select { display: block !important; }

.wf-input-wrap input:focus,
.wf-input-wrap select:focus,
.wf-input-wrap textarea:focus { border-bottom-color: var(--wf-accent); }

.wf-input-wrap select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 24px;
    cursor: pointer;
}

.wf-input-wrap textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ── Radio & Checkbox groups ─────────────────────────────────────── */

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

.wf-group-label {
    font-size: 12px; font-weight: 600;
    color: #888; letter-spacing: .01em;
    margin-bottom: 6px;
}

/* ── Contenedor de opciones — los 3 modos ────────────────────────── */

.wf-options-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Modo "en línea": fila con wrap → en móvil pasan a columna sólos */
.wf-options-inline {
    flex-direction: row;
    flex-wrap: wrap;          /* ← wrap siempre activo */
    gap: 8px 16px;
}

/* Modo "botones": fila con wrap → ídem */
.wf-options-buttons {
    flex-direction: row;
    flex-wrap: wrap;          /* ← wrap siempre activo */
    gap: 6px;
}

/* En pantallas muy pequeñas los modos inline/buttons vuelven a columna */
@media (max-width: 360px) {
    .wf-options-inline,
    .wf-options-buttons { flex-direction: column; }
}

/* ── Ocultar el input nativo ─────────────────────────────────────── */
.wf-radio-label input[type="radio"],
.wf-checkbox-label input[type="checkbox"],
.wf-opt-btn-label input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

/* ── Label contenedor ────────────────────────────────────────────── */
.wf-radio-label,
.wf-checkbox-label {
    display: flex; align-items: center; gap: 9px;
    cursor: pointer; font-size: 14px; color: #333;
    padding: 2px 0; user-select: none;
}

/* ── Indicador radio ─────────────────────────────────────────────── */
.wf-radio-indicator {
    width: 18px; height: 18px;
    border: 2px solid #bbb;
    border-radius: 50%; flex-shrink: 0;
    display: inline-block; position: relative;
    transition: border-color .2s; box-sizing: border-box;
}
.wf-radio-label:hover .wf-radio-indicator { border-color: var(--wf-accent); }
.wf-radio-label input[type="radio"]:checked ~ .wf-radio-indicator { border-color: var(--wf-accent); }
.wf-radio-label input[type="radio"]:checked ~ .wf-radio-indicator::after {
    content: ''; position: absolute; inset: 3px;
    border-radius: 50%; background: var(--wf-accent);
}
.wf-radio-label input[type="radio"]:focus-visible ~ .wf-radio-indicator {
    outline: 2px solid var(--wf-accent); outline-offset: 2px;
}

/* ── Indicador checkbox ──────────────────────────────────────────── */
.wf-checkbox-indicator {
    width: 18px; height: 18px;
    border: 2px solid #bbb; border-radius: 3px;
    flex-shrink: 0; display: inline-block; position: relative;
    transition: border-color .2s, background .2s; box-sizing: border-box;
}
.wf-checkbox-label:hover .wf-checkbox-indicator { border-color: var(--wf-accent); }
.wf-checkbox-label input[type="checkbox"]:checked ~ .wf-checkbox-indicator {
    border-color: var(--wf-accent); background: var(--wf-accent);
}
.wf-checkbox-label input[type="checkbox"]:checked ~ .wf-checkbox-indicator::after {
    content: ''; position: absolute;
    left: 4px; top: 1px; width: 6px; height: 10px;
    border: 2px solid #fff; border-top: none; border-left: none;
    transform: rotate(45deg);
}
.wf-checkbox-label input[type="checkbox"]:focus-visible ~ .wf-checkbox-indicator {
    outline: 2px solid var(--wf-accent); outline-offset: 2px;
}

/* ── Modo botones ────────────────────────────────────────────────── */
/* El radio de bordes usa --wf-btn-radius, inyectado inline por PHP  */
.wf-options-buttons .wf-opt-btn-label {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border: 2px solid #ddd;
    border-radius: var(--wf-btn-radius, 20px); /* fallback */
    cursor: pointer;
    font-size: 13px;
    color: #555;
    font-weight: 500;
    transition: border-color .2s, background .2s, color .2s;
    user-select: none;
    line-height: 1.3;
    position: relative;   /* para el input oculto */
}
.wf-options-buttons .wf-opt-btn-label:hover {
    border-color: var(--wf-accent);
    color: var(--wf-accent);
}
/* :has() — navegadores modernos */
.wf-options-buttons .wf-opt-btn-label:has(input:checked) {
    border-color: var(--wf-accent);
    background: var(--wf-accent);
    color: #fff;
}
/* Fallback clase JS .wf-btn-checked */
.wf-options-buttons .wf-opt-btn-label.wf-btn-checked {
    border-color: var(--wf-accent);
    background: var(--wf-accent);
    color: #fff;
}

/* ── Materialize overrides ───────────────────────────────────────── */
.wf-popup-modal .wf-radio-label label,
.wf-inline-form-wrap .wf-radio-label label,
.wf-popup-modal .wf-checkbox-label label,
.wf-inline-form-wrap .wf-checkbox-label label { transform: none !important; font-size: 14px !important; }
.wf-radio-label [type="radio"] + span::before,
.wf-radio-label [type="radio"] + span::after,
.wf-checkbox-label [type="checkbox"] + span::before,
.wf-checkbox-label [type="checkbox"] + span::after { display: none !important; }

/* ── Rating stars ────────────────────────────────────────────────── */
.wf-rating-stars { display: flex; gap: 4px; margin-top: 4px; }
.wf-star {
    background: none; border: none;
    font-size: 28px; cursor: pointer;
    color: var(--wf-accent); opacity: .3;
    transition: opacity .15s, transform .15s;
    padding: 0; line-height: 1;
}
.wf-star:hover, .wf-star-active { opacity: 1; }
.wf-star:hover { transform: scale(1.2); }

/* ── Special fields ──────────────────────────────────────────────── */
.wf-field-heading {
    font-size: 15px; font-weight: 700; color: #333;
    padding: 8px 0 4px;
    border-bottom: 2px solid var(--wf-accent);
    margin-bottom: 2px;
}
.wf-field-divider { border: none; border-top: 1px solid #e0e0e0; margin: 4px 0; }

/* ── Validation ──────────────────────────────────────────────────── */
.wf-invalid { border-bottom-color: #e53935 !important; }
.wf-field-error { font-size: 11px; color: #e53935; margin-top: 3px; display: block; }
.wf-form-error {
    background: #fde8e8; border: 1px solid #e53935; border-radius: 6px;
    color: #c62828; padding: 10px 14px; font-size: 13px; margin-top: 12px;
}
.wf-req { color: #e53935; margin-left: 2px; font-weight: 700; }

/* ── Footer ──────────────────────────────────────────────────────── */
.wf-popup-footer {
    padding: 14px 20px;
    border-top: 1px solid #eee;
    display: flex; flex-direction: column; gap: 10px;
    flex-shrink: 0; background: #fafafa;
}
.wf-email-notice {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #888;
}

/* ── Submit button ───────────────────────────────────────────────── */
.wf-submit-btn {
    width: 100%; padding: 14px;
    color: #fff; border: none; border-radius: 6px;
    font-size: 16px; font-weight: 700; cursor: pointer;
    letter-spacing: .02em;
    transition: filter .2s, transform .15s;
    font-family: inherit;
    display: flex; align-items: center; justify-content: center;
}
.wf-submit-btn:hover  { filter: brightness(1.1); transform: translateY(-1px); }
.wf-submit-btn:active { transform: translateY(0); }
.wf-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.wf-submit-loading {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; font-size: 13px; color: #666; padding: 4px 0;
}
.wf-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(0,0,0,.15);
    border-top-color: var(--wf-accent);
    border-radius: 50%;
    animation: wf-spin .7s linear infinite;
    display: inline-block;
}
@keyframes wf-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════
   SUCCESS STATE (email-only)
   ═══════════════════════════════════════════════════════════════════ */

.wf-form-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 20px;
    gap: 10px;
    animation: wf-success-in .4s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes wf-success-in {
    from { opacity: 0; transform: scale(.85); }
    to   { opacity: 1; transform: scale(1); }
}

.wf-success-icon {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 4px;
}

.wf-success-title {
    font-size: 20px;
    font-weight: 700;
    color: #1d2327;
}

.wf-success-msg {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    max-width: 280px;
}

/* ── Materialize overrides ───────────────────────────────────────── */
.wf-popup-modal .select-wrapper { border-bottom: 2px solid #ddd !important; }
.wf-popup-modal .select-wrapper input.select-dropdown { border-bottom: none !important; }
.wf-popup-modal .dropdown-content { border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.wf-popup-modal label { transform: none !important; font-size: 12px !important; }

/* ── Static text field ───────────────────────────────────────────── */
.wf-field-static-text {
    background: #fffbf0;
    border: 1px solid #ffe082;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px; color: #555; line-height: 1.6;
    width: 100%; box-sizing: border-box;
}

/* ── Inline form ─────────────────────────────────────────────────── */
.wf-inline-form-wrap {
    background: #fff;
    border-radius: var(--wf-radius);
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.wf-inline-description { font-size: 14px; color: #666; margin: 0; padding: 16px 20px 0; line-height: 1.6; }
.wf-inline-form-wrap .wf-popup-form { padding: 20px; }
.wf-inline-footer {
    padding: 14px 20px;
    border-top: 1px solid #eee;
    background: #fafafa;
    display: flex; flex-direction: column; gap: 10px;
}
.wf-inline-submit { width: 100%; }

/* ═══════════════════════════════════════════════════════════════════════════
   WF WAF — AntiSpam / Captcha  (v1.3)
   ═══════════════════════════════════════════════════════════════════════════ */

.wf-captcha-area {
    padding: 10px 0 4px;
}

/* reCAPTCHA v2 / Turnstile widget wrapper */
.wf-captcha-widget {
    display: inline-block;
    min-height: 64px;
}

/* reCAPTCHA v3 notice badge */
.wf-captcha-v3-notice {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: #9ca3af;
    padding: 4px 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    gap: 4px;
}
.wf-captcha-v3-notice svg {
    fill: #6b7280;
    flex-shrink: 0;
}

/* Error message bajo el captcha */
.wf-captcha-error {
    margin-top: 8px;
    font-size: 12px;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 7px 12px;
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WF WAF — Boolean / Tab / Step  (v1.4)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Boolean toggle (Sí / No) ────────────────────────────────────────────── */
.wf-boolean-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0 6px;
}

.wf-boolean-toggle {
    --wf-accent: #25D366;
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #dde1e7;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background .22s ease;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}
.wf-boolean-toggle:focus-visible {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wf-accent) 35%, transparent);
}
.wf-boolean-toggle.wf-boolean-on {
    background: var(--wf-accent);
}
.wf-bool-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: left .22s ease;
    pointer-events: none;
}
.wf-boolean-toggle.wf-boolean-on .wf-bool-knob {
    left: 23px;
}

.wf-bool-false-lbl,
.wf-bool-true-lbl {
    font-size: 14px;
    font-weight: 600;
    transition: color .18s, opacity .18s;
    color: #1a1a1a;
}
.wf-bool-sep {
    font-size: 13px;
    color: #ccc;
}
.wf-bool-lbl-dim {
    color: #adb5bd !important;
    font-weight: 400 !important;
}

/* ── Tab bar (construido por JS) ─────────────────────────────────────────── */
.wf-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 18px;
}

.wf-tab-btn {
    --wf-accent: #25D366;
    position: relative;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .18s, border-color .18s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    white-space: nowrap;
}
.wf-tab-btn:hover {
    color: var(--wf-accent);
}
.wf-tab-btn:focus {
    background-color: transparent !important;
}
.wf-tab-btn.wf-tab-active {
    color: var(--wf-accent);
    border-bottom-color: var(--wf-accent);

}
.wf-tab-btn:focus-visible {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--wf-accent) 40%, transparent);
    border-radius: 4px 4px 0 0;
    
}

/* ── Step: barra de progreso (construida por JS) ─────────────────────────── */
.wf-step-progress {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin-bottom: 22px;
    counter-reset: wf-step;
    padding: 0 4px;
}

.wf-step-dot {
    --wf-accent: #25D366;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
    cursor: default;
    transition: color .2s;
}
/* Conector entre dots */
.wf-step-dot:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: calc(50% + 14px);
    right: calc(-50% + 14px);
    height: 2px;
    background: #e5e7eb;
    transition: background .25s;
    z-index: 0;
}
.wf-step-dot.wf-step-dot-done:not(:last-child)::after {
    background: var(--wf-accent);
}

/* Círculo numerado */
.wf-step-dot::before {
    counter-increment: wf-step;
    content: counter(wf-step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    border: 2px solid #e5e7eb;
    transition: background .2s, color .2s, border-color .2s;
    position: relative;
    z-index: 1;
}
.wf-step-dot.wf-step-dot-done::before {
    content: '✓';
    background: var(--wf-accent);
    border-color: var(--wf-accent);
    color: #fff;
}
.wf-step-dot.wf-step-dot-active {
    color: var(--wf-accent);
}
.wf-step-dot.wf-step-dot-active::before {
    background: #fff;
    border-color: var(--wf-accent);
    color: var(--wf-accent);
}

/* ── Step: navegación (anterior / siguiente) ─────────────────────────────── */
.wf-step-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0 4px;
    margin-top: 4px;
    border-top: 1px solid #f0f0f0;
}

.wf-step-back-btn,
.wf-step-next-btn {
    --wf-accent: #25D366;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .18s, transform .12s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.wf-step-back-btn:active,
.wf-step-next-btn:active {
    transform: scale(.97);
}
.wf-step-back-btn {
    background: #f3f4f6;
    color: #374151;
}
.wf-step-back-btn:hover { background: #e5e7eb; }

.wf-step-next-btn {
    background: var(--wf-accent);
    color: #fff;
    margin-left: auto;
}
.wf-step-next-btn:hover { opacity: .88; }

.wf-step-back-btn:focus-visible,
.wf-step-next-btn:focus-visible {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wf-accent) 35%, transparent);
}

/* Responsive: en pantallas pequeñas los labels de step se reducen */
@media (max-width: 480px) {
    .wf-step-dot { font-size: 10px; }
    .wf-tab-btn  { padding: 8px 12px; font-size: 13px; }
    .wf-step-back-btn,
    .wf-step-next-btn { padding: 9px 16px; font-size: 13px; }
}
