/* ==========================================================================
   BEAST STARS - CHATBOT INTELIGENTE DE SOPORTE (CSS)
   Diseño no invasivo, flotante, con Glassmorphism y temas Ultra / GPT
   ========================================================================== */

:root {
    --bot-accent: #f3701e;
    --bot-accent-hover: #ff8533;
    --bot-accent-rgb: 243, 112, 30;
    --bot-glow: rgba(243, 112, 30, 0.35);
    --bot-bg: #12151b;
    --bot-bg-surface: #1a1e27;
    --bot-bg-card: #212633;
    --bot-border: rgba(255, 255, 255, 0.08);
    --bot-border-glow: rgba(243, 112, 30, 0.25);
    --bot-text: #f3f4f6;
    --bot-text-muted: #9ca3af;
    --bot-font: 'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif;
}

/* Tema específico para ChatGPT PRO */
body.theme-gpt {
    --bot-accent: #10b981;
    --bot-accent-hover: #34d399;
    --bot-accent-rgb: 16, 185, 129;
    --bot-glow: rgba(16, 185, 129, 0.35);
    --bot-bg: #091310;
    --bot-bg-surface: #0e1e19;
    --bot-bg-card: #152923;
    --bot-border: rgba(16, 185, 129, 0.15);
    --bot-border-glow: rgba(16, 185, 129, 0.3);
}

/* --------------------------------------------------------------------------
   BOTÓN LANZADOR FLOTANTE (DISCRETO & NO INVASIVO)
   -------------------------------------------------------------------------- */
#beastars-bot-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-family: var(--bot-font);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bot-launcher-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bot-bg-surface), var(--bot-bg));
    border: 2px solid var(--bot-border-glow);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px var(--bot-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.bot-launcher-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 24px var(--bot-glow);
    border-color: var(--bot-accent);
}

.bot-launcher-btn img.bot-emblem {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 50%;
    pointer-events: none;
    transition: transform 0.3s ease;
}

.bot-launcher-btn:hover img.bot-emblem {
    transform: rotate(5deg) scale(1.05);
}

/* Indicador de estado en vivo (punto verde) */
.bot-online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2px solid var(--bot-bg);
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: botPulse 2s infinite ease-in-out;
}

@keyframes botPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Toast/Burbuja de sugerencia inicial (no invasiva) */
.bot-hint-bubble {
    background: rgba(18, 21, 27, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--bot-border-glow);
    border-radius: 24px 24px 6px 24px;
    padding: 10px 16px;
    color: var(--bot-text);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.bot-hint-bubble.show {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

.bot-hint-bubble .hint-close {
    cursor: pointer;
    font-size: 14px;
    color: var(--bot-text-muted);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease;
}

.bot-hint-bubble .hint-close:hover {
    color: #fff;
}

/* --------------------------------------------------------------------------
   VENTANA DEL CHATBOT (MODAL FLOTANTE MODERNO)
   -------------------------------------------------------------------------- */
#beastars-bot-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: rgba(18, 22, 28, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bot-border-glow);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: none !important;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--bot-font);
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#beastars-bot-window.open {
    display: flex !important;
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
}

/* Cabecera del Bot */
.bot-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.2) 100%), var(--bot-bg-surface);
    border-bottom: 1px solid var(--bot-border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bot-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bot-bg-card);
    border: 1px solid var(--bot-border-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bot-header-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.bot-header-text h3 {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bot-header-text .status-tag {
    font-size: 11px;
    color: var(--bot-accent);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.bot-header-text .status-tag::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}

.bot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bot-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--bot-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bot-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* Área de mensajes */
.bot-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.bot-messages-area::-webkit-scrollbar {
    width: 5px;
}

.bot-messages-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Burbujas de mensaje */
.bot-msg {
    display: flex;
    gap: 10px;
    max-width: 92%;
    animation: botMsgFadeIn 0.3s ease-out;
}

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

.bot-msg.from-bot {
    align-self: flex-start;
}

.bot-msg.from-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bot-bg-card);
    border: 1px solid var(--bot-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.bot-msg-avatar img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.bot-msg-content {
    background: var(--bot-bg-surface);
    border: 1px solid var(--bot-border);
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--bot-text);
}

.bot-msg.from-user .bot-msg-content {
    background: var(--bot-accent);
    color: #fff;
    border-color: transparent;
    font-weight: 500;
}

.bot-msg.from-bot .bot-msg-content {
    border-top-left-radius: 4px;
}

.bot-msg.from-user .bot-msg-content {
    border-top-right-radius: 4px;
}

.bot-text-p {
    margin-bottom: 6px;
    line-height: 1.45;
}

#beastars-chatbot-root img {
    max-width: 100% !important;
    display: inline-block;
}

/* Tarjetas informativas dentro de los mensajes */
.bot-card-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0;
}

.bot-step-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.bot-step-item:last-child {
    margin-bottom: 0;
}

.bot-step-badge {
    background: var(--bot-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    flex-shrink: 0;
}

.bot-step-text {
    font-size: 13px;
    color: var(--bot-text);
}

.bot-code-pill {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f59e0b;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

/* Sugerencias Rápidas (Chips / Botones de Temas Frecuentes) */
.bot-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.bot-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.bot-chip-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--bot-border-glow);
    color: var(--bot-text);
    padding: 7px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bot-chip-btn:hover {
    background: var(--bot-accent);
    color: #fff;
    border-color: var(--bot-accent);
    transform: translateY(-1px);
}

.bot-chip-btn .bot-icon {
    color: var(--bot-accent);
    transition: color 0.2s ease;
}

.bot-chip-btn:hover .bot-icon {
    color: #fff;
}

/* Botón CTA para WhatsApp / Soporte */
.bot-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25D366;
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 10px;
    margin-top: 8px;
    transition: background-color 0.2s, transform 0.2s;
}

.bot-cta-btn:hover {
    background: #1eb956;
    transform: translateY(-1px);
}

/* Selector de pestañas dentro de respuesta (ej. Chrome vs Edge) */
.bot-tabs-nav {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.bot-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--bot-text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bot-tab-btn.active {
    background: var(--bot-accent);
    color: #fff;
}

/* Barra de Entrada / Input */
.bot-footer {
    padding: 12px 14px;
    background: var(--bot-bg-surface);
    border-top: 1px solid var(--bot-border);
}

.bot-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bot-bg);
    border: 1px solid var(--bot-border-glow);
    border-radius: 25px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bot-input-form:focus-within {
    border-color: var(--bot-accent);
    box-shadow: 0 0 10px var(--bot-glow);
}

.bot-input-form input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    font-family: var(--bot-font);
}

.bot-input-form input::placeholder {
    color: var(--bot-text-muted);
}

.bot-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bot-accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
    flex-shrink: 0;
}

.bot-send-btn:hover {
    background: var(--bot-accent-hover);
    transform: scale(1.05);
}

.bot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Branding inferior sutil */
.bot-brand-tag {
    text-align: center;
    font-size: 10px;
    color: var(--bot-text-muted);
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   RESPONSIVIDAD (MÓVILES)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    #beastars-bot-window {
        bottom: 84px;
        right: 12px;
        left: 12px;
        width: calc(100vw - 24px);
        max-width: 100vw;
        height: 520px;
    }

    #beastars-bot-launcher {
        bottom: 16px;
        right: 16px;
    }

    .bot-launcher-btn {
        width: 52px;
        height: 52px;
    }

    .bot-launcher-btn img.bot-emblem {
        width: 34px;
        height: 34px;
    }

    .bot-hint-bubble {
        display: none !important;
    }

    .bot-input-form input {
        font-size: 16px !important;
    }
}
