/**
 * Big Pies - WhatsApp Sedes Interactivo (Estilo Joinchat)
 * Frontend Styles
 */

:root {
    --bpwsi-green: #25D366;
    --bpwsi-green-dark: #128C7E;
    --bpwsi-green-deep: #075E54;
    --bpwsi-primary: #027017;
    --bpwsi-bg-light: #F0F2F5;
    --bpwsi-text-dark: #111B21;
    --bpwsi-text-muted: #667781;
    --bpwsi-white: #ffffff;
    --bpwsi-shadow: 0 10px 36px rgba(0, 0, 0, 0.18);
    --bpwsi-radius: 18px;
    --bpwsi-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* CONTENEDOR PRINCIPAL FLOTANTE */
.bpwsi-container {
    position: fixed !important;
    bottom: 24px !important;
    z-index: 99999999 !important;
    font-family: var(--bpwsi-font);
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    pointer-events: none !important;
    -webkit-font-smoothing: antialiased;
}

.bpwsi-container * {
    box-sizing: border-box;
}

.bpwsi-container.bpwsi-pos-right {
    right: 24px !important;
    left: auto !important;
    align-items: flex-end !important;
}

.bpwsi-container.bpwsi-pos-left {
    left: 24px !important;
    right: auto !important;
    align-items: flex-start !important;
}

/* BOTÓN FLOTANTE TRIGGER */
.bpwsi-float-button {
    pointer-events: auto !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background-color: var(--bpwsi-green) !important;
    color: var(--bpwsi-white) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0,0,0,0.15) !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease, box-shadow 0.2s ease !important;
    position: relative !important;
    outline: none !important;
    user-select: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    -webkit-tap-highlight-color: transparent;
}

.bpwsi-float-button:hover {
    transform: scale(1.08);
    background-color: #20ba5a;
    box-shadow: 0 6px 26px rgba(37, 211, 102, 0.6), 0 3px 8px rgba(0,0,0,0.2);
}

.bpwsi-float-button:active {
    transform: scale(0.95);
}

.bpwsi-float-button svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.bpwsi-icon-close-btn {
    display: none;
    font-size: 32px;
    line-height: 1;
    font-weight: 300;
}

.bpwsi-modal-is-open .bpwsi-icon-open {
    display: none;
}

.bpwsi-modal-is-open .bpwsi-icon-close-btn {
    display: block;
}

/* ONDA DE PULSO (PULSE ANIMATION) */
.bpwsi-has-pulse::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.45);
    animation: bpwsi-pulse 2.2s infinite cubic-bezier(0.24, 0, 0.38, 1);
    z-index: -1;
}

@keyframes bpwsi-pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

/* BADGE ROJO DE NOTIFICACIÓN */
.bpwsi-badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #e53935;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    animation: bpwsi-bounce 0.6s ease;
}

@keyframes bpwsi-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-2px); }
}

/* GLOBO CALL TO ACTION ENRIQUECIDO (TIPO JOINCHAT AVANZADO) */
.bpwsi-balloon {
    pointer-events: auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 14px;
    max-width: 330px;
    width: 330px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
    position: relative;
    cursor: pointer;
    animation: bpwsi-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bpwsi-balloon:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
}

.bpwsi-pos-right .bpwsi-balloon::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 22px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

.bpwsi-pos-left .bpwsi-balloon::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 22px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

.bpwsi-balloon-close {
    all: unset !important;
    box-sizing: border-box !important;
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    bottom: auto !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 50% !important;
    color: #475569 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    z-index: 25 !important;
    transition: all 0.2s ease !important;
    line-height: 1 !important;
}

.bpwsi-balloon-close:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #ef4444 !important;
    transform: scale(1.12) !important;
}

.bpwsi-balloon-close svg {
    display: block !important;
    width: 12px !important;
    height: 12px !important;
    stroke: currentColor !important;
    stroke-width: 3px !important;
}

/* ENCABEZADO DEL GLOBO CON LOGO BIG PIES */
.bpwsi-balloon-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.bpwsi-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.bpwsi-balloon-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e2e8f0;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.bpwsi-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.bpwsi-online-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 11px;
    height: 11px;
    background-color: #25D366;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: bpwsi-glow 1.8s infinite;
}

@keyframes bpwsi-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    50% { box-shadow: 0 0 0 4px rgba(37, 211, 102, 0); }
}

.bpwsi-balloon-meta {
    flex: 1;
    padding-right: 14px;
}

.bpwsi-balloon-sender {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    display: block;
    line-height: 1.2;
}

.bpwsi-balloon-status {
    font-size: 11px;
    color: #027017;
    font-weight: 600;
    display: block;
}

/* CUERPO DEL GLOBO */
.bpwsi-greeting-badge {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.bpwsi-balloon-hook {
    font-size: 13.5px;
    color: #0f172a;
    line-height: 1.35;
    margin: 0 0 6px 0;
}

.bpwsi-balloon-desc {
    font-size: 12px;
    color: #475569;
    line-height: 1.35;
    margin: 0 0 8px 0;
}

.bpwsi-balloon-cta-tag {
    display: inline-flex;
    align-items: center;
    background: #e8f5e9;
    color: #1b5e20;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 10px;
}

/* BOTÓN DE ACCIÓN RÁPIDA EN EL GLOBO */
.bpwsi-balloon-actions {
    margin-top: 4px;
}

.bpwsi-balloon-btn-open {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #25D366;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.bpwsi-balloon:hover .bpwsi-balloon-btn-open {
    background: #20ba5a;
}

/* MODAL INTERACTIVO DE SEDES */
.bpwsi-modal {
    pointer-events: auto;
    position: absolute;
    bottom: 74px;
    width: 375px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border-radius: var(--bpwsi-radius);
    box-shadow: var(--bpwsi-shadow);
    overflow: hidden;
    animation: bpwsi-modal-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.08);
}

.bpwsi-pos-right .bpwsi-modal {
    right: 0;
}

.bpwsi-pos-left .bpwsi-modal {
    left: 0;
}

@keyframes bpwsi-modal-enter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bpwsi-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CABECERA DEL POPUP CON LOGO BIG PIES */
.bpwsi-modal-header {
    background: linear-gradient(135deg, var(--bpwsi-green-deep) 0%, var(--bpwsi-green-dark) 100%);
    padding: 16px 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bpwsi-modal-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bpwsi-modal-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    flex-shrink: 0;
    overflow: hidden;
}

.bpwsi-modal-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.bpwsi-modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.bpwsi-modal-subtitle {
    margin: 3px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1;
}

.bpwsi-modal-close {
    all: unset !important;
    box-sizing: border-box !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    padding: 0 !important;
    margin: 0 0 0 10px !important;
    background: rgba(255, 255, 255, 0.22) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    line-height: 1 !important;
}

.bpwsi-modal-close:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    transform: scale(1.1) rotate(90deg) !important;
}

.bpwsi-modal-close svg {
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    stroke: currentColor !important;
    stroke-width: 3px !important;
}

/* CUERPO DEL POPUP */
.bpwsi-modal-body {
    padding: 16px;
    background: #fafafa;
}

.bpwsi-service-tag {
    background: #e8f5e9;
    border-left: 3px solid var(--bpwsi-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: #1b5e20;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.bpwsi-tag-icon {
    font-size: 18px;
}

.bpwsi-tag-sub {
    font-size: 11px;
    color: #027017;
    font-weight: 700;
    margin-top: 1px;
}

.bpwsi-modal-intro {
    font-size: 13px;
    color: #334155;
    margin: 0 0 14px 0;
    line-height: 1.4;
}

/* LISTA DE TARJETAS DE SEDES */
.bpwsi-sedes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bpwsi-sede-item {
    display: block;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    text-decoration: none !important;
    color: inherit;
    transition: all 0.22s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.bpwsi-sede-item:hover {
    border-color: var(--bpwsi-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.18);
}

.bpwsi-sede-item-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.bpwsi-icon-pin {
    font-size: 18px;
    margin-top: 1px;
}

.bpwsi-sede-item-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bpwsi-sede-item-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a202c;
}

.bpwsi-sede-item-addr {
    font-size: 12px;
    color: #718096;
}

.bpwsi-sede-item-hours {
    font-size: 11.5px;
    color: #027017;
    font-weight: 500;
    margin-top: 2px;
}

.bpwsi-btn-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--bpwsi-green);
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 25px;
    transition: background-color 0.2s ease;
}

.bpwsi-sede-item:hover .bpwsi-btn-chat {
    background: #20ba5a;
}

.bpwsi-modal-footer-note {
    text-align: center;
    margin-top: 12px;
    font-size: 11px;
    color: #94a3b8;
}

/* SHORTCODE INLINE BUTTONS */
.bpwsi-inline-cta-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--bpwsi-green);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
}

.bpwsi-inline-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #027017;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.bpwsi-inline-cta-head h4 {
    margin: 0 0 6px 0;
    color: #0f172a;
    font-size: 17px;
}

.bpwsi-inline-cta-head p {
    margin: 0 0 14px 0;
    font-size: 13.5px;
    color: #64748b;
}

.bpwsi-inline-cta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.bpwsi-inline-btn {
    display: flex;
    flex-direction: column;
    background: #25D366;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.bpwsi-inline-btn:hover {
    background: #20ba5a;
    transform: translateY(-2px);
    color: #ffffff !important;
}

.bpwsi-inline-btn small {
    font-weight: 400;
    font-size: 11.5px;
    opacity: 0.9;
    margin-top: 2px;
}

/* RESPONSIVE MOBILE */
@media (max-width: 480px) {
    .bpwsi-container.bpwsi-pos-right {
        right: 16px;
        bottom: 16px;
    }

    .bpwsi-container.bpwsi-pos-left {
        left: 16px;
        bottom: 16px;
    }

    .bpwsi-modal {
        bottom: 70px;
        width: calc(100vw - 32px);
        max-height: 80vh;
        overflow-y: auto;
    }

    .bpwsi-balloon {
        max-width: 290px;
        width: calc(100vw - 32px);
    }
}
