
/* ===== Jeypi — widget de chat de Auranah ===== */

#jeypi-widget {
    --jeypi-azul: #0B5ED7;
    --jeypi-profundo: #123B7A;
    --jeypi-borde: #E7EDF6;
    --jeypi-texto: #374151;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
}

/* Aísla el widget de los estilos generales del sitio */
#jeypi-widget *,
#jeypi-widget *::before,
#jeypi-widget *::after {
    box-sizing: border-box;
}

/* --- Botón flotante --- */

#jeypi-toggle {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: transparent;
    padding: 0;
    overflow: hidden;
    line-height: 0;
    cursor: pointer;
    opacity: .92;
    box-shadow: 0 4px 14px rgba(18, 59, 122, .18);
    transition: transform .2s ease, opacity .2s ease, box-shadow .2s ease;
}

#jeypi-toggle:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(18, 59, 122, .26);
}

#jeypi-toggle:focus-visible {
    outline: 2px solid var(--jeypi-azul);
    outline-offset: 3px;
}

#jeypi-toggle img {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Ventana --- */

#jeypi-window {
    /* El sitio aplica padding a <section>; aquí se anula */
    padding: 0;
    margin: 0;
    position: absolute;
    right: 0;
    bottom: 66px;
    width: 332px;
    height: 440px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(18, 59, 122, .16), 0 2px 8px rgba(18, 59, 122, .08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--jeypi-borde);
    transform-origin: bottom right;
    animation: jeypi-aparecer .22s ease-out;
}

@keyframes jeypi-aparecer {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#jeypi-window.jeypi-hidden {
    display: none;
}

/* --- Encabezado --- */

.jeypi-header {
    background: #fff;
    color: var(--jeypi-profundo);
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--jeypi-borde);
}

.jeypi-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
}

.jeypi-avatar img {
    width: 100%;
    height: 100%;
    display: block;
}

.jeypi-header-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.jeypi-header-info strong {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.jeypi-header-info span {
    font-size: 11.5px;
    font-weight: 400;
    color: #6B7A90;
}

#jeypi-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #8A96A8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

#jeypi-close:hover {
    background: #F3F6FB;
    color: var(--jeypi-profundo);
}

/* --- Mensajes --- */

.jeypi-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #FAFBFD;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #D5DEEB transparent;
}

.jeypi-messages::-webkit-scrollbar { width: 6px; }
.jeypi-messages::-webkit-scrollbar-thumb {
    background: #D5DEEB;
    border-radius: 3px;
}

.jeypi-message {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    animation: jeypi-mensaje .18s ease-out;
}

@keyframes jeypi-mensaje {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.jeypi-bot {
    background: #fff;
    color: var(--jeypi-texto);
    align-self: flex-start;
    border: 1px solid var(--jeypi-borde);
    border-bottom-left-radius: 5px;
}

.jeypi-user {
    background: var(--jeypi-azul);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

/* --- Barra de escritura --- */

.jeypi-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--jeypi-borde);
    background: #fff;
    align-items: center;
}

#jeypi-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #DDE5F0;
    border-radius: 20px;
    padding: 9px 14px;
    outline: none;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--jeypi-texto);
    background: #F7F9FC;
    transition: border-color .15s ease, background .15s ease;
}

#jeypi-input::placeholder { color: #9AA6B8; }

#jeypi-input:focus {
    border-color: var(--jeypi-azul);
    background: #fff;
}

.jeypi-input-area button {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: none;
    border-radius: 50%;
    background: var(--jeypi-azul);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.jeypi-input-area button:hover {
    background: #0A52BC;
    transform: scale(1.05);
}

.jeypi-input-area button svg {
    width: 17px;
    height: 17px;
    display: block;
}

/* --- Pie --- */

/* El pie se eliminó: repetía el texto del encabezado y robaba altura al chat */
.jeypi-footer { display: none; }

/* --- Móvil --- */

/* --- Respuestas rápidas (widget del POS) --- */

.jeypi-rapidas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px 0;
    background: #fff;
}

.jeypi-rapidas button {
    font: inherit;
    font-size: 12.5px;
    line-height: 1.2;
    color: var(--jeypi-azul);
    background: #F3F7FD;
    border: 1px solid var(--jeypi-borde);
    border-radius: 999px;
    padding: 6px 11px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.jeypi-rapidas button:hover,
.jeypi-rapidas button:focus-visible {
    background: #E7F0FC;
    border-color: var(--jeypi-azul);
    outline: none;
}

@media (max-width: 480px) {
    #jeypi-widget {
        right: 16px;
        bottom: 18px;
    }

    #jeypi-toggle {
        width: 48px;
        height: 48px;
    }

    #jeypi-window {
        position: fixed;
        right: 10px;
        bottom: 78px;
        width: calc(100vw - 20px);
        height: min(480px, calc(100dvh - 120px));
    }
}

@media (prefers-reduced-motion: reduce) {
    #jeypi-window, .jeypi-message { animation: none; }
    #jeypi-toggle:hover { transform: none; }
}
