/* ============================================================
   JB BELLEZA CHATBOT PRO — Estilos
   ============================================================ */

:root {
    --jb-primary:     #e01076;
    --jb-dark:        #111111;
    --jb-light:       #f7f7f7;
    --jb-white:       #ffffff;
    --jb-shadow:      0 12px 40px rgba(0,0,0,.18);
    --jb-radius:      20px;
    --jb-radius-sm:   12px;
    --jb-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Botón flotante ─────────────────────────────────────── */
#jb-chatbot-toggle {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--jb-primary);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 4px 18px rgba(224,16,118,.45);
    transition: transform .2s ease, box-shadow .2s ease;
    font-size: 26px;
    border: none;
}

#jb-chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(224,16,118,.6);
}

/* ── Ventana del chat ───────────────────────────────────── */
#jb-chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 22px;
    width: 390px;
    max-width: calc(100vw - 24px);
    height: 520px;
    background: var(--jb-white);
    border-radius: var(--jb-radius);
    display: none;
    flex-direction: column;
    box-shadow: var(--jb-shadow);
    overflow: hidden;
    z-index: 99998;
    font-family: var(--jb-font);
    animation: jb-slide-in .25s ease;
}

@keyframes jb-slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

#jb-chatbot-window.active {
    display: flex;
}

/* ── Header ─────────────────────────────────────────────── */
.jb-chat-header {
    background: var(--jb-dark);
    color: var(--jb-white);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.jb-header-avatar {
    font-size: 28px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jb-header-info {
    flex: 1;
}

.jb-header-name {
    font-weight: 700;
    font-size: 15px;
}

.jb-header-status {
    font-size: 12px;
    opacity: .75;
    margin-top: 2px;
}

.jb-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: .7;
    padding: 4px 8px;
    border-radius: 6px;
    transition: opacity .2s;
}
.jb-close-btn:hover { opacity: 1; }

/* ── Área de mensajes ───────────────────────────────────── */
.jb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--jb-light);
    scroll-behavior: smooth;
}

.jb-chat-messages::-webkit-scrollbar { width: 5px; }
.jb-chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 5px;
}

/* ── Mensajes ───────────────────────────────────────────── */
.jb-user-message,
.jb-bot-message {
    max-width: 88%;
    padding: 11px 15px;
    border-radius: var(--jb-radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.jb-user-message {
    background: var(--jb-primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.jb-bot-message {
    background: var(--jb-white);
    color: var(--jb-dark);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

.jb-ai-text {
    margin-bottom: 10px;
    font-size: 14px;
}

.jb-inline-link {
    color: var(--jb-primary) !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    word-break: break-all !important;
}

.jb-products-label {
    font-weight: 700;
    font-size: 13px;
    margin: 10px 0 8px;
    color: var(--jb-primary);
}

/* ── Quick replies ──────────────────────────────────────── */
.jb-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.jb-quick-btn {
    background: var(--jb-light);
    border: 1.5px solid var(--jb-primary);
    color: var(--jb-primary);
    border-radius: 50px;
    padding: 6px 13px;
    font-size: 12px;
    cursor: pointer;
    transition: all .18s;
    font-family: var(--jb-font);
}

.jb-quick-btn:hover {
    background: var(--jb-primary);
    color: #fff;
}

/* ── Indicador de escritura ─────────────────────────────── */
.jb-chat-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    color: #888;
    background: var(--jb-light);
    flex-shrink: 0;
}

.jb-chat-typing span {
    width: 7px;
    height: 7px;
    background: var(--jb-primary);
    border-radius: 50%;
    display: inline-block;
    animation: jb-bounce .9s infinite;
}
.jb-chat-typing span:nth-child(2) { animation-delay: .15s; }
.jb-chat-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes jb-bounce {
    0%, 80%, 100% { transform: scale(.7); opacity: .6; }
    40%            { transform: scale(1);  opacity: 1;  }
}

/* ── Footer / input ─────────────────────────────────────── */
.jb-chat-footer {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.jb-chat-input {
    flex: 1;
    padding: 11px 14px !important;
    border: 1.5px solid #ddd !important;
    border-radius: 50px !important;
    font-size: 14px !important;
    font-family: var(--jb-font) !important;
    color: #222 !important;
    background: var(--jb-light) !important;
    outline: none !important;
    transition: border-color .2s !important;
    box-shadow: none !important;
}

.jb-chat-input:focus {
    border-color: var(--jb-primary) !important;
}

.jb-send-btn {
    background: var(--jb-primary) !important;
    color: #fff !important;
    border: none !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform .18s, opacity .18s !important;
}

.jb-send-btn:hover {
    transform: scale(1.08) !important;
    opacity: .9 !important;
}

/* ── Tarjeta de producto ────────────────────────────────── */
.jb-product-card {
    display: flex;
    gap: 12px;
    background: var(--jb-white);
    border: 1px solid #eee;
    border-radius: var(--jb-radius-sm);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    transition: box-shadow .2s;
}

.jb-product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

.jb-product-image {
    width: 88px !important;
    height: 88px !important;
    object-fit: cover !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
}

.jb-product-info {
    flex: 1;
    min-width: 0;
}

.jb-product-cat {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--jb-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 3px;
}

.jb-product-title {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--jb-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.jb-product-price {
    color: #007a4d;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.jb-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 50px;
    margin-bottom: 5px;
}

.jb-badge-stock   { background: #eaffef; color: #007a4d; }
.jb-badge-nostock { background: #fff0f0; color: #c0392b; }

.jb-product-hook {
    font-size: 11px;
    color: #777;
    margin-bottom: 6px;
}

.jb-upsell {
    font-size: 11px;
    background: #fff8e6;
    border-radius: 6px;
    padding: 4px 8px;
    margin-bottom: 7px;
    color: #865400;
}

.jb-upsell a {
    color: var(--jb-primary) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

.jb-product-buttons {
    display: flex;
    gap: 7px;
    margin-top: 6px;
}

.jb-btn-view,
.jb-btn-cart {
    padding: 7px 12px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-block !important;
    transition: opacity .18s !important;
}

.jb-btn-view {
    background: #eee !important;
    color: var(--jb-dark) !important;
}

.jb-btn-cart {
    background: var(--jb-primary) !important;
    color: #fff !important;
}

.jb-btn-view:hover,
.jb-btn-cart:hover {
    opacity: .85 !important;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
    #jb-chatbot-window {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 88px;
        height: 80vh;
        border-radius: 18px;
    }

    #jb-chatbot-toggle {
        right: 14px;
        bottom: 14px;
    }
}
