/* ═══════════════════════════════════════════════════
   WP WhatsApp Leads – Widget CSS (Bubble + Modal)
═══════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────── */
#wwpl-modal, #wwpl-bubble {
    --wwpl-radius: 16px;
    --wwpl-shadow: 0 12px 48px rgba(0,0,0,.22);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    box-sizing: border-box;
}
#wwpl-modal *, #wwpl-bubble * { box-sizing: border-box; }

/* ── Botón flotante ───────────────────────────── */
#wwpl-bubble {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    z-index: 2147483647 !important;
    flex-direction: row-reverse !important;
    pointer-events: auto !important;
}
/* Variante izquierda (clase añadida por JS si bubble_pos=bottom-left) */
#wwpl-bubble.wwpl-pos-left {
    right: auto;
    left: 24px;
    flex-direction: row;  /* botón izquierda, label a la derecha */
}
#wwpl-bubble-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(0,0,0,.28);
    transition: transform .2s, box-shadow .2s;
    animation: wwpl-pulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
}
#wwpl-bubble-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 32px rgba(0,0,0,.35);
    animation: none;
}
#wwpl-bubble-label {
    display: none;        /* oculto por defecto, JS lo muestra tras 10s */
    background: #fff;
    color: #222;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,.14);
    white-space: nowrap;
    animation: wwpl-fadein .5s ease;
}

@keyframes wwpl-pulse {
    0%,100% { transform: scale(1);    box-shadow: 0 6px 24px rgba(0,0,0,.28); }
    50%      { transform: scale(1.06); box-shadow: 0 8px 28px rgba(37,211,102,.5); }
}
@keyframes wwpl-fadein {
    from { opacity:0; transform:translateX(12px); }
    to   { opacity:1; transform:translateX(0); }
}

/* ── Overlay ──────────────────────────────────── */
#wwpl-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99991;
    backdrop-filter: blur(2px);
    animation: wwpl-fadein .25s ease;
}
#wwpl-overlay.wwpl-active { display: block; }

/* ── Modal ────────────────────────────────────── */
#wwpl-modal {
    display: none;
    position: fixed !important;
    bottom: 100px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 360px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 120px);
    border-radius: var(--wwpl-radius);
    box-shadow: var(--wwpl-shadow);
    overflow: hidden;
    flex-direction: column;
    z-index: 99993 !important;
    background: #f0ebe0;
    animation: wwpl-slide-up .3s cubic-bezier(.34,1.56,.64,1);
}
#wwpl-modal.wwpl-pos-left {
    right: auto !important;
    left: 24px !important;
}
#wwpl-modal.wwpl-active {
    display: flex !important;
}

@keyframes wwpl-slide-up {
    from { opacity:0; transform:translateY(30px) scale(.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

/* Header */
#wwpl-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: #fff;
}
#wwpl-modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
#wwpl-modal-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#wwpl-modal-title {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0 0 2px;
    line-height: 1.2;
}
#wwpl-modal-subtitle {
    font-size: 11.5px;
    margin: 0;
    opacity: .9;
    display: flex;
    align-items: center;
    gap: 5px;
}
#wwpl-modal-close {
    background: rgba(255,255,255,.18);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s;
}
#wwpl-modal-close:hover { background: rgba(255,255,255,.35); }

/* Chat bubble */
#wwpl-chat-bubble {
    margin: 14px 14px 0;
    padding: 12px 14px;
    background: #fff;
    border-radius: 0 12px 12px 12px;
    font-size: 13.5px;
    color: #333;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    animation: wwpl-fadein .5s .15s both;
}
#wwpl-chat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    border: 8px solid transparent;
    border-top-color: #fff;
    border-left: 0;
}

/* Form area */
#wwpl-form-wrap {
    padding: 14px 14px 6px;
    overflow-y: auto;
    flex: 1;
}
.wwpl-field {
    margin-bottom: 11px;
}
.wwpl-field label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 4px;
}
.wwpl-req { color: #e74c3c; }

.wwpl-field input[type="text"],
.wwpl-field input[type="email"],
.wwpl-field input[type="tel"],
.wwpl-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 13.5px;
    background: #fff;
    color: #222;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.wwpl-field input:focus,
.wwpl-field select:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37,211,102,.15);
}
.wwpl-phone-row {
    display: flex;
    gap: 7px;
    align-items: center;
}
.wwpl-flag {
    flex-shrink: 0;
    padding: 9px 10px;
    background: #f0f0f0;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 12.5px;
    color: #555;
    white-space: nowrap;
}
.wwpl-phone-row input { flex: 1; }

/* Error */
#wwpl-error {
    font-size: 12.5px;
    color: #c0392b;
    background: #fdecea;
    border-left: 3px solid #c0392b;
    padding: 7px 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* Submit button */
#wwpl-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 30px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter .2s, transform .15s;
    margin-top: 4px;
}
#wwpl-submit:hover  { filter: brightness(1.08); }
#wwpl-submit:active { transform: scale(.98); }
#wwpl-submit:disabled { opacity: .7; cursor: not-allowed; }

/* Success screen */
#wwpl-success {
    text-align: center;
    padding: 30px 20px 20px;
}
#wwpl-success-icon { font-size: 48px; margin-bottom: 10px; }
#wwpl-success p    { color: #333; margin: 4px 0; font-size: 14px; }
#wwpl-success-sub  { color: #888; font-size: 12.5px; }

/* Footer */
#wwpl-modal-footer {
    text-align: center;
    font-size: 11.5px;
    color: #888;
    padding: 8px;
    border-top: 1px solid #e8e0d4;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Online dot */
.wwpl-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    animation: wwpl-blink 2.2s ease-in-out infinite;
}
@keyframes wwpl-blink {
    0%,100% { opacity:1; }
    50%      { opacity:.3; }
}

/* ── Responsive mobile ────────────────────────── */
@media (max-width: 480px) {
    #wwpl-modal {
        bottom: 0 !important;
        top: auto !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92dvh;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }
    #wwpl-modal.wwpl-pos-left { left: 0 !important; right: 0 !important; }
    /* En móvil: siempre derecha, label oculto */
    #wwpl-bubble {
        bottom: 16px !important;
        right: 16px !important;
        left: auto !important;
    }
    #wwpl-bubble.wwpl-pos-left {
        left: 16px !important;
        right: auto !important;
    }
    #wwpl-bubble-label { display: none !important; }
}
