/* SUSHUMA AI BOT - ESTÉTICA HOLÍSTICA Y DUAL */
#sushuma-bot-widget {
    position: fixed;
    bottom: 30px;
    left: 30px; /* Al lado opuesto de WhatsApp (que suele estar a la derecha) */
    z-index: 1060;
    font-family: 'Raleway', sans-serif;
}

#sushuma-bot-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purpura-sushuma, #7454A6), #5A3D8A);
    color: white;
    border: 2px solid var(--mimo-gold, #d4af37);
    box-shadow: 0 4px 15px rgba(116, 84, 166, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#sushuma-bot-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

#sushuma-bot-panel {
    position: fixed;
    bottom: 90px;
    left: 30px;
    width: 350px;
    height: 500px;
    background: #ffffff;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom left;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    z-index: 1061;
}

#sushuma-bot-panel.active {
    transform: scale(1);
    opacity: 1;
}

/* Encabezado adaptable según Persona */
.sushuma-bot-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-family: 'Playfair Display', serif;
    flex-shrink: 0; /* Nunca se encoge */
}

.sushuma-bot-header.b2c {
    background: linear-gradient(135deg, #7454A6, #9C77CE); /* Púrpura Espiritual */
}

.sushuma-bot-header.b2b {
    background: linear-gradient(135deg, #3d2d5f, #2C3E50); /* Púrpura Oscuro/Slate Corporativo */
}

.sushuma-bot-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sushuma-bot-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 44px; /* Área táctil recomendada por Apple */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: -8px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.sushuma-bot-close:active {
    background: rgba(255, 255, 255, 0.3); /* Feedback visual al tocar */
}

#sushuma-bot-messages {
    flex: 1 1 0;
    min-height: 0;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Evita que el scroll se escape hacia el panel padre */
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: url('../logo-encabezado.webp') no-repeat center center;
    background-size: 50%;
    background-blend-mode: overlay;
    background-color: rgba(255,255,255,0.9);
}

.sbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.35;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.sbot-msg.ai-msg {
    align-self: flex-start;
    background: white;
    color: #333;
    border-radius: 0 12px 12px 12px;
    border-left: 3px solid var(--purpura-sushuma, #7454A6);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.sbot-msg.ai-msg.b2b-style {
    border-left: 3px solid #3d2d5f;
}

.sbot-msg.user-msg {
    align-self: flex-end;
    background: var(--purpura-sushuma, #7454A6);
    color: white;
    border-radius: 12px 12px 0 12px;
    box-shadow: 0 2px 10px rgba(116, 84, 166, 0.2);
}

#sushuma-bot-input-area {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 2px solid var(--purpura-sushuma, #7454A6);
    box-shadow: 0 -4px 15px rgba(0,0,0,0.08);
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* Nunca se encoge */
}

#sushuma-bot-input {
    flex-grow: 1;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-family: 'Raleway', sans-serif;
    font-size: 16px; /* Evita zoom automático en iPhone */
    background: #f8f9fa;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#sushuma-bot-input:focus {
    border-color: var(--purpura-sushuma, #7454A6);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(116, 84, 166, 0.15);
}

#sushuma-bot-send {
    background: var(--mimo-gold, #d4af37);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

#sushuma-bot-send:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------- */
/* RESPONSIVE: CELULARES (B2C)      */
/* -------------------------------- */
@media (max-width: 576px) {
    #sushuma-bot-panel {
        width: 90vw;
        height: 55vh; /* No ocupa toda la pantalla: deja espacio para el teclado */
        left: 5vw;
        bottom: 70px;
    }
    
    #sushuma-bot-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
        bottom: 15px;
        left: 15px;
        border-width: 1px;
        box-shadow: 0 2px 10px rgba(116, 84, 166, 0.3);
    }
}

/* ---------------------------------------------------- */
/* REGLAS EXCLUSIVAS PARA POS MÓVIL (EMBAJADORAS)       */
/* ---------------------------------------------------- */
body[data-pos="true"] #sushuma-bot-btn {
    display: none !important;
}

/* Bandeja inferior 60vh con layout absoluto (NO flex).
   Cada elemento tiene coordenadas fijas dentro del panel,
   así iOS no puede arrastrar nada fuera de su lugar. */
body[data-pos="true"] #sushuma-bot-panel {
    position: fixed !important;
    width: 100vw !important;
    height: 60vh !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 20px 20px 0 0;
    border: none;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    transform-origin: bottom center;
    display: block !important; /* CLAVE: Anula el flex para usar posicionamiento absoluto */
    overflow: hidden !important;
}

/* Encabezado CLAVADO arriba del panel */
body[data-pos="true"] .sushuma-bot-header {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 20;
    padding: 10px 16px;
    box-sizing: border-box;
}

/* Mensajes: ocupa el espacio entre el header y el input */
body[data-pos="true"] #sushuma-bot-messages {
    position: absolute !important;
    top: 50px;    /* Justo debajo del header */
    left: 0;
    right: 0;
    bottom: 56px; /* Justo encima del input */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: block !important;
    padding: 10px 12px;
}

/* Input CLAVADO abajo del panel */
body[data-pos="true"] #sushuma-bot-input-area {
    position: absolute !important;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 20;
    padding: 8px 12px;
    box-sizing: border-box;
    background: #ffffff;
}

/* Overlay oscuro detrás del panel */
body[data-pos="true"] #sushuma-bot-panel.active::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 40vh;
    background: rgba(0,0,0,0.35);
    z-index: -1;
    pointer-events: none;
}

