/* ──────────────────────────────────────────────
   WhatsApp IA — Frontend Styles v2.2
   ────────────────────────────────────────────── */

/* ── Aislamiento frente a estilos del tema ── */
.whatsapp-float,
.whatsapp-float *,
.whatsapp-modal,
.whatsapp-modal *,
.wa-inline-button,
.wa-inline-button * {
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    letter-spacing: normal;
}

.whatsapp-float button,
.whatsapp-modal button,
.whatsapp-modal input,
.whatsapp-modal textarea,
.whatsapp-modal select,
.wa-inline-button {
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none;
    text-transform: none !important;
}

.whatsapp-modal p,
.whatsapp-modal label,
.whatsapp-modal input,
.whatsapp-modal textarea,
.whatsapp-modal select,
.whatsapp-modal button,
.whatsapp-modal svg,
.whatsapp-modal span {
    margin-top: 0;
}

.whatsapp-modal input,
.whatsapp-modal textarea,
.whatsapp-modal select,
.whatsapp-modal button {
    min-width: 0 !important;
}

.whatsapp-modal svg,
.whatsapp-float svg,
.wa-inline-button svg {
    display: block;
    max-width: none !important;
}

/* ── Botón flotante ── */
.whatsapp-float {
    position: fixed !important;
    z-index: 9999 !important;
}

.whatsapp-button {
    background: #25D366 !important;
    color: #fff !important;
    padding: 12px 20px !important;
    border-radius: 50px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(37,211,102,0.42) !important;
    transition: background .22s ease, transform .18s ease, box-shadow .22s ease;
    font-weight: 600 !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    border: none !important;
    outline: none !important;
    min-height: 0 !important;
    height: auto !important;
    -webkit-tap-highlight-color: transparent;
}
.whatsapp-button:hover {
    background: #128C7E;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(18,140,126,0.48);
}
.whatsapp-button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(37,211,102,0.45);
}

/* ── Overlay ── */
.whatsapp-modal {
    position: fixed !important;
    z-index: 2147483000 !important;
    inset: 0 !important;
    background: rgba(0,0,0,.52) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-width: none !important;
    animation: wa-overlay-in .18s ease;
}
@keyframes wa-overlay-in { from{opacity:0} to{opacity:1} }

/* ── Modal wrapper ── */
.whatsapp-modal-content {
    background: #fff !important;
    border: 0 !important;
    border-radius: 14px !important;
    width: 100% !important;
    max-width: 400px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    box-shadow: 0 24px 64px rgba(0,0,0,.28) !important;
    color: #111827 !important;
    line-height: 1.4 !important;
    animation: wa-modal-in .24s cubic-bezier(.34,1.52,.64,1);
}
@keyframes wa-modal-in {
    from { opacity:0; transform:scale(.88) translateY(18px); }
    to   { opacity:1; transform:scale(1)   translateY(0);    }
}

/* ═══════════════════════════════════════
   CABECERA — layout de una sola fila
═══════════════════════════════════════ */
.wa-header {
    background: #075e54 !important;
    padding: 12px 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    min-height: 62px !important;
    border: 0 !important;
}

.wa-header-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}
.wa-header-avatar svg { width:26px; height:26px; fill:#fff; display:block; }

.wa-header-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}
.wa-header-title {
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
}
.wa-header-sub {
    color: rgba(255,255,255,.72) !important;
    font-size: 12.5px !important;
    font-weight: 400 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.wa-header-close {
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    background: transparent !important;
    border: none !important;
    color: rgba(255,255,255,.8) !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background .14s;
    line-height: 1 !important;
    text-decoration: none !important;
}
.wa-header-close:hover { background: rgba(255,255,255,.15); color:#fff; }
.wa-header-close:focus-visible { outline:2px solid #fff; outline-offset:2px; }
.wa-header-close svg { width:18px; height:18px; fill:currentColor; display:block; }

/* ═══════════════════════════════════════
   BODY
═══════════════════════════════════════ */
.wa-body {
    padding: 18px 18px 22px !important;
    background: #f7f8fa !important;
    border: 0 !important;
}

/* ── Badge estado ── */
.wa-status {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    color: #374151 !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
}
.wa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.wa-status-dot.online  { background:#25D366; animation: wa-pulse 2s infinite; }
.wa-status-dot.offline { background:#9ca3af; }
@keyframes wa-pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ── Burbuja de mensaje ── */
.wa-bubble {
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0 10px 10px 10px !important;
    padding: 10px 13px !important;
    margin: 0 0 16px !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
    color: #111827 !important;
    line-height: 1.55 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.07) !important;
    position: relative !important;
    max-width: 90% !important;
}
.wa-bubble::before {
    content:'';
    position:absolute;
    top:0; left:-8px;
    border-width:0 8px 8px 0;
    border-style:solid;
    border-color:transparent #e5e7eb transparent transparent;
}
.wa-bubble::after {
    content:'';
    position:absolute;
    top:1px; left:-6px;
    border-width:0 6px 6px 0;
    border-style:solid;
    border-color:transparent #fff transparent transparent;
}
.wa-bubble-icon {
    display:inline-block;
    vertical-align: middle;
    margin-right: 4px;
}
.wa-bubble-icon svg { width:15px; height:15px; fill:#6b7280; display:inline-block; vertical-align:middle; }

/* ── Formulario ── */
.wa-form {
    display:flex !important;
    flex-direction:column !important;
    gap:11px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wa-field {
    display:flex !important;
    flex-direction:column !important;
    gap:4px !important;
    margin: 0 !important;
    padding: 0 !important;
}
.wa-hp-field {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}
.wa-consent {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    font-size: 12.5px !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
    color: #4b5563 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.wa-consent input {
    width: 15px !important;
    height: 15px !important;
    min-width: 15px !important;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    accent-color: #075e54 !important;
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
}
.wa-consent a { color: #075e54 !important; text-decoration: underline !important; }

.wa-field label {
    display: block !important;
    font-size:11px !important;
    font-weight:700 !important;
    color:#4b5563 !important;
    text-transform:uppercase !important;
    letter-spacing:.55px !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wa-field input,
.wa-field textarea,
.wa-field select {
    display: block !important;
    background:#fff !important;
    background-image: none !important;
    border: 1.5px solid #d1d5db !important;
    border-radius:7px !important;
    padding: 9px 12px !important;
    font-size:14.5px !important;
    font-weight: 400 !important;
    color:#111827 !important;
    line-height: 1.35 !important;
    transition: border-color .14s, box-shadow .14s !important;
    width:100% !important;
    max-width: 100% !important;
    outline:none !important;
    text-align: left !important;
    text-decoration: none !important;
}

.wa-field input,
.wa-field select {
    height: 42px !important;
    min-height: 42px !important;
}

.wa-field textarea {
    min-height:82px !important;
    max-height:150px !important;
}

.wa-field input:hover,
.wa-field textarea:hover,
.wa-field select:hover { border-color:#9ca3af !important; }
.wa-field input:focus,
.wa-field textarea:focus,
.wa-field select:focus { border-color:#25D366 !important; box-shadow:0 0 0 3px rgba(37,211,102,.13) !important; }
.wa-field input::placeholder,
.wa-field textarea::placeholder { color:#9ca3af !important; opacity: 1 !important; }
.wa-field textarea { resize:vertical !important; }

/* ── Botón envío ── */
.wa-submit {
    background:#25D366 !important;
    color:#fff !important;
    border:none !important;
    border-radius:22px !important;
    padding:12px 20px !important;
    font-size:15px !important;
    font-weight:700 !important;
    line-height: 1.2 !important;
    cursor:pointer !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:8px !important;
    transition: background .18s, transform .1s !important;
    margin:2px 0 0 !important;
    width:100% !important;
    height: auto !important;
    min-height: 44px !important;
    box-shadow:0 2px 8px rgba(37,211,102,.33) !important;
    text-decoration: none !important;
}
.wa-submit:hover:not(:disabled)  { background:#128C7E; }
.wa-submit:active:not(:disabled) { transform:scale(.98); }
.wa-submit:disabled               { background:#d1d5db; cursor:not-allowed; box-shadow:none; }
.wa-submit:focus-visible          { outline:3px solid #075e54; outline-offset:2px; }
.wa-submit svg { width:18px; height:18px; fill:#fff; flex-shrink:0; }

/* ── Responsive: mobile bottom-sheet ── */
@media (max-width:480px){
    .whatsapp-modal { align-items:flex-end; padding:0; }
    .whatsapp-modal-content {
        border-radius:18px 18px 0 0;
        max-width:100%;
        width:100%;
        animation: wa-slide-up .28s cubic-bezier(.22,1,.36,1);
        max-height:92dvh;
        overflow-y:auto;
    }
    @keyframes wa-slide-up {
        from { transform:translateY(100%); opacity:.8; }
        to   { transform:translateY(0);    opacity:1;  }
    }
    .wa-body { padding:14px 14px 30px; }
}

/* ══════════════════════════════════════════════
   Botón inline — shortcode [whatsapp_button]
   .wa-inline-button.wa-open-modal
══════════════════════════════════════════════ */
.wa-inline-button {
    display:          inline-flex !important;
    align-items:      center !important;
    justify-content:  center !important;
    gap:              9px !important;
    background:       #25D366 !important;
    color:            #fff !important;
    padding:          11px 22px !important;
    border-radius:    50px !important;
    font-size:        15px !important;
    font-weight:      600 !important;
    line-height:      1.2 !important;
    border:           none !important;
    cursor:           pointer !important;
    text-decoration:  none !important;
    box-shadow:       0 4px 16px rgba(37,211,102,.38) !important;
    transition:       background .22s ease, transform .18s ease, box-shadow .22s ease !important;
    -webkit-tap-highlight-color: transparent;
    vertical-align:   middle !important;
    min-height:       0 !important;
    height:           auto !important;
}
.wa-inline-button svg {
    flex-shrink: 0 !important;
}
.wa-inline-button:hover {
    background:   #128C7E !important;
    transform:    translateY(-1px);
    box-shadow:   0 6px 20px rgba(18,140,126,.44) !important;
}
.wa-inline-button:focus-visible {
    outline:       3px solid #fff;
    outline-offset: 2px;
    box-shadow:    0 0 0 5px rgba(37,211,102,.45);
}
.wa-inline-button:active {
    transform: translateY(0);
}

/* Tamaños */
.wa-inline-button.wa-inline-sm {
    font-size:  13px !important;
    padding:    8px 16px !important;
    gap:        7px !important;
}
.wa-inline-button.wa-inline-sm svg {
    width:  15px;
    height: 15px;
}
.wa-inline-button.wa-inline-lg {
    font-size:  17px !important;
    padding:    14px 28px !important;
    gap:        11px !important;
}
.wa-inline-button.wa-inline-lg svg {
    width:  22px;
    height: 22px;
}

/* Ancho completo */
.wa-inline-button.wa-inline-full {
    display: flex !important;
    width:   100% !important;
    justify-content: center !important;
}
