/* ═══════════════════════════════════════════════════
   DivoChat – Widget CSS v2.2
═══════════════════════════════════════════════════ */

/* ── Variables & reset base ───────────────────── */
#wwpl-modal, #wwpl-bubble {
    --wwpl-green:  #25D366;
    --wwpl-dark:   #075E54;
    --wwpl-radius: 16px;
    --wwpl-shadow: 0 8px 40px rgba(0,0,0,.18);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    box-sizing: border-box;
    line-height: 1.4;
}
#wwpl-modal *, #wwpl-bubble * {
    box-sizing: border-box;
    font-family: inherit !important;
}

/* ── 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;
}
#wwpl-bubble.wwpl-pos-left {
    right: auto !important;
    left: 24px !important;
    flex-direction: row !important;
}
#wwpl-bubble-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    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.08);
    box-shadow: 0 8px 28px rgba(0,0,0,.32);
    animation: none;
}
#wwpl-bubble-label {
    display: none;
    background: #fff;
    color: #111;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    white-space: nowrap;
    animation: wwpl-fadein .4s ease;
}

@keyframes wwpl-pulse {
    0%,100% { transform: scale(1);    box-shadow: 0 4px 20px rgba(0,0,0,.25); }
    50%      { transform: scale(1.07); box-shadow: 0 6px 26px rgba(37,211,102,.45); }
}
@keyframes wwpl-fadein {
    from { opacity:0; transform:translateX(10px); }
    to   { opacity:1; transform:translateX(0); }
}

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

/* ── Modal contenedor ─────────────────────────── */
#wwpl-modal {
    display: none;
    position: fixed !important;
    bottom: 96px !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: #ffffff;
    animation: wwpl-slide-up .28s cubic-bezier(.34,1.4,.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(22px) scale(.98); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

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

/* ── Chat bubble ──────────────────────────────── */
#wwpl-chat-bubble {
    margin: 14px 16px 0;
    padding: 11px 14px;
    background: #f0f4f8;
    border-radius: 4px 12px 12px 12px;
    font-size: 13.5px !important;
    color: #444 !important;
    line-height: 1.55;
    position: relative;
    animation: wwpl-fadein .4s .1s both;
}
#wwpl-chat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -7px;
    border: 7px solid transparent;
    border-top-color: #f0f4f8;
    border-left: 0;
}

/* ── Área del formulario ──────────────────────── */
#wwpl-form-wrap {
    padding: 16px 16px 8px;
    overflow-y: auto;
    flex: 1;
    background: #fff;
}

.wwpl-field {
    margin-bottom: 12px;
}
.wwpl-field label {
    display: block !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #4a5568 !important;
    margin-bottom: 5px !important;
    text-transform: uppercase !important;
    letter-spacing: .4px !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}
.wwpl-req { color: #e53e3e !important; }

/* Inputs — !important para neutralizar temas */
.wwpl-field input[type="text"],
.wwpl-field input[type="email"],
.wwpl-field input[type="tel"],
.wwpl-field select {
    width: 100% !important;
    padding: 10px 13px !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    background: #f8fafc !important;
    color: #1a202c !important;
    outline: none !important;
    transition: border-color .2s, box-shadow .2s, background .2s !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    height: auto !important;
    line-height: 1.4 !important;
}
.wwpl-field input[type="text"]::placeholder,
.wwpl-field input[type="email"]::placeholder,
.wwpl-field input[type="tel"]::placeholder {
    color: #a0aec0 !important;
    opacity: 1 !important;
}
.wwpl-field input:focus,
.wwpl-field select:focus {
    border-color: #25D366 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(37,211,102,.12) !important;
}
.wwpl-field select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23718096' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 34px !important;
}

/* Fila teléfono */
.wwpl-phone-row {
    display: flex;
    gap: 7px;
    align-items: center;
}
.wwpl-flag {
    flex-shrink: 0;
    padding: 10px 11px !important;
    background: #f8fafc !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: #4a5568 !important;
    white-space: nowrap;
    font-weight: 500;
    line-height: 1.4;
}
.wwpl-phone-row input { flex: 1; }

/* Error */
#wwpl-error {
    font-size: 12.5px !important;
    color: #c53030 !important;
    background: #fff5f5 !important;
    border-left: 3px solid #fc8181 !important;
    padding: 8px 11px !important;
    border-radius: 6px !important;
    margin-bottom: 10px !important;
    line-height: 1.4 !important;
}

/* Botón enviar */
#wwpl-submit {
    width: 100% !important;
    padding: 13px !important;
    border: none !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: filter .2s, transform .15s !important;
    margin-top: 6px !important;
    letter-spacing: .1px !important;
    line-height: 1.4 !important;
    box-shadow: 0 4px 14px rgba(37,211,102,.35) !important;
}
#wwpl-submit:hover  { filter: brightness(1.06) !important; box-shadow: 0 6px 18px rgba(37,211,102,.45) !important; }
#wwpl-submit:active { transform: scale(.98) !important; }
#wwpl-submit:disabled { opacity: .65 !important; cursor: not-allowed !important; box-shadow: none !important; }

/* Pantalla de éxito */
#wwpl-success {
    text-align: center;
    padding: 36px 24px 28px;
    background: #fff;
}
#wwpl-success p    { color: #2d3748 !important; margin: 6px 0 !important; font-size: 15px !important; }
#wwpl-success-sub  { color: #718096 !important; font-size: 13px !important; }

/* Footer */
#wwpl-modal-footer {
    text-align: center;
    font-size: 11.5px !important;
    color: #a0aec0 !important;
    padding: 9px 8px;
    border-top: 1px solid #f0f4f8;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
}

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

/* ── Ciudad extra condicional ─────────────────── */
#wwpl-ciudad-extra-wrap {
    display: none;
    margin-top: 4px;
    padding: 10px 12px;
    background: rgba(37,211,102,.06);
    border: 1.5px solid rgba(37,211,102,.22);
    border-radius: 8px;
}
#wwpl-ciudad-extra-label {
    display: block !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #276749 !important;
    text-transform: uppercase !important;
    letter-spacing: .4px !important;
    margin-bottom: 5px !important;
}

/* ── Responsive móvil ─────────────────────────── */
@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: 20px 20px 0 0;
    }
    #wwpl-modal.wwpl-pos-left { left: 0 !important; right: 0 !important; }
    #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; }
}
