/* ==========================================================================
   SMARTBOT ASSISTANT - ESTILOS VISUALES & ANIMACIONES DE ALTA TECNOLOGÍA
   Smartlab Barranquilla • Centro de Capacitación & Soporte Técnico
   ========================================================================== */

/* Botón Flotante Launcher */
#smartbot-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#smartbot-trigger-btn,
.smartbot-btn-trigger,
.smartbot-launcher-btn {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%);
    border: 2px solid rgba(147, 197, 253, 0.4);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5), 0 0 20px rgba(59, 130, 246, 0.35);
    cursor: pointer;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#smartbot-trigger-btn:hover,
.smartbot-btn-trigger:hover,
.smartbot-launcher-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.6), 0 0 30px rgba(96, 165, 250, 0.5);
    border-color: rgba(255, 255, 255, 0.8);
}

#smartbot-trigger-btn:active,
.smartbot-btn-trigger:active,
.smartbot-launcher-btn:active {
    transform: scale(0.95);
}

/* Indicador de onda o pulso alrededor del botón */
.smartbot-pulse-ring {
    position: absolute;
    inset: -6px;
    border-radius: 24px;
    border: 2px solid rgba(56, 189, 248, 0.5);
    animation: smartbot-pulse 2.2s infinite ease-out;
    pointer-events: none;
}

@keyframes smartbot-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* Badge de tooltip flotante */
.smartbot-launcher-tooltip {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ventana Principal del Chat */
#smartbot-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 32px);
    height: 640px;
    max-height: calc(100vh - 120px);
    background: rgba(10, 15, 30, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 24px;
    z-index: 100000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px rgba(37, 99, 235, 0.25);
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#smartbot-window.smartbot-active,
#smartbot-window.active,
#smartbot-window[style*="display: flex"],
#smartbot-window[style*="display:flex"] {
    display: flex !important;
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* Cabecera del Chat */
.smartbot-header {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.7) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.smartbot-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.5), transparent);
}

.smartbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.smartbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1.5px solid #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    font-size: 18px;
    position: relative;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.smartbot-avatar .online-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #0f172a;
}

.smartbot-title-area h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.smartbot-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.smartbot-mode-badge.public-mode,
.smartbot-mode-badge.public {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.smartbot-mode-badge.private-mode,
.smartbot-mode-badge.taller {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

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

.smartbot-tool-btn,
.smartbot-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.smartbot-tool-btn:hover,
.smartbot-btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.smartbot-tool-btn.active,
.smartbot-btn-icon.active {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.5);
}

/* Área de Mensajes */
.smartbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Burbujas de Chat */
.smartbot-msg,
.smartbot-message {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: smartbot-fade-in 0.25s ease-out;
}

@keyframes smartbot-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.smartbot-msg.user {
    align-self: flex-end;
}

.smartbot-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
}

.smartbot-msg.bot .smartbot-bubble {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.smartbot-msg.user .smartbot-bubble {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
    border: 1px solid rgba(147, 197, 253, 0.3);
    border-top-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.smartbot-msg-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.smartbot-msg.user .smartbot-msg-time {
    align-self: flex-end;
}

/* Estilos de Contenido Técnico dentro de las Burbujas */
.smartbot-bubble strong {
    color: #38bdf8;
    font-weight: 700;
}

.smartbot-bubble .smartbot-alert {
    background: rgba(245, 158, 11, 0.12);
    border-left: 3px solid #f59e0b;
    padding: 8px 10px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 12px;
    color: #fde68a;
}

.smartbot-bubble .smartbot-badge-tag {
    display: inline-block;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.smartbot-bubble ul {
    margin: 6px 0;
    padding-left: 18px;
}

.smartbot-bubble li {
    margin-bottom: 4px;
}

/* Botón de Desbloqueo / Clave dentro del Chat */
.smartbot-unlock-card {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.8), rgba(15, 23, 42, 0.9));
    border: 1.5px solid rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    padding: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.smartbot-unlock-card-btn {
    background: linear-gradient(90deg, #d97706, #f59e0b);
    color: #0f172a;
    font-weight: 800;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.smartbot-unlock-card-btn:hover {
    background: linear-gradient(90deg, #b45309, #d97706);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

/* Sugerencias Rápidas (Chips) */
.smartbot-quick-chips {
    padding: 8px 14px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.4);
}

.smartbot-quick-chips::-webkit-scrollbar {
    display: none;
}

.smartbot-chip {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 5px 11px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.smartbot-chip:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    transform: translateY(-1px);
}

/* Barra de Estado de Audio / Grabación */
.smartbot-audio-status {
    padding: 6px 14px;
    background: rgba(220, 38, 38, 0.15);
    border-top: 1px solid rgba(220, 38, 38, 0.3);
    color: #f87171;
    font-size: 11px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: space-between;
}

.smartbot-audio-status.active {
    display: flex;
}

.smartbot-voice-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 14px;
}

.smartbot-voice-bar {
    width: 3px;
    height: 100%;
    background: #ef4444;
    border-radius: 2px;
    animation: smartbot-wave 0.8s infinite ease-in-out;
}

.smartbot-voice-bar:nth-child(2) { animation-delay: 0.15s; }
.smartbot-voice-bar:nth-child(3) { animation-delay: 0.3s; }
.smartbot-voice-bar:nth-child(4) { animation-delay: 0.45s; }

@keyframes smartbot-wave {
    0%, 100% { height: 4px; }
    50% { height: 14px; }
}

/* Pie de Entrada (Input + Botones) */
.smartbot-footer {
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.smartbot-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.smartbot-input-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.smartbot-input {
    width: 100%;
    background: rgba(2, 6, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.smartbot-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.smartbot-mic-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.smartbot-mic-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.smartbot-mic-btn.listening {
    background: #ef4444 !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    animation: smartbot-pulse 1.2s infinite;
}

.smartbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    border: 1px solid rgba(147, 197, 253, 0.4);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.smartbot-send-btn:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
    transform: scale(1.04);
}

.smartbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Botón flotante para detener lectura de voz */
.smartbot-speaking-indicator {
    padding: 4px 10px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 20px;
    color: #38bdf8;
    font-size: 10px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    display: none;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.smartbot-speaking-indicator.active {
    display: inline-flex;
}

/* Caja destacada de referencia comercial para compra */
.smartbot-part-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    border-radius: 14px;
    padding: 12px 14px;
    margin: 10px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.smartbot-part-ref {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 6px 10px;
    border-radius: 8px;
    margin: 6px 0;
}

.smartbot-part-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 13px;
    color: #fbbf24;
    letter-spacing: 0.05em;
}

.smartbot-buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(90deg, #0284c7, #2563eb);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid rgba(147, 197, 253, 0.3);
    margin-top: 6px;
}

.smartbot-buy-btn:hover {
    background: linear-gradient(90deg, #0369a1, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    color: #ffffff;
}

/* Banner de transcripción en vivo */
.smartbot-live-speech {
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #fca5a5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: smartbot-fade-in 0.2s ease-out;
}

.smartbot-live-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 10px;
    color: #cbd5e1;
}

.smartbot-live-finish-btn {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.smartbot-live-finish-btn:hover {
    background: #dc2626;
}

/* Adaptabilidad Móvil */
@media (max-width: 640px) {
    #smartbot-launcher {
        bottom: 16px;
        right: 16px;
    }

    #smartbot-window {
        bottom: 84px;
        right: 12px;
        left: 12px;
        width: auto;
        height: calc(100vh - 100px);
        max-height: none;
        border-radius: 20px;
    }
}

/* ==========================================================================
   ESTILOS ADICIONALES: COMPENDIO DE FALLAS, GEMINI AI & CONFIGURACIÓN
   ========================================================================== */

/* Tarjetas de Guías de Diagnóstico Paso a Paso */
.smartbot-troubleshoot-box {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 14px;
    padding: 12px 14px;
    margin: 8px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.smartbot-troubleshoot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

.smartbot-step-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 6px 0;
}

.smartbot-step-item {
    background: rgba(30, 41, 59, 0.6);
    border-left: 3px solid #38bdf8;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
}

.smartbot-step-item.warning {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.smartbot-step-item.success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

/* Indicador de pensamiento de Gemini AI */
.smartbot-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
    padding: 6px 0;
}

.smartbot-thinking-dots {
    display: flex;
    gap: 4px;
}

.smartbot-thinking-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    animation: smartbot-bounce 1.4s infinite ease-in-out both;
}

.smartbot-thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.smartbot-thinking-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes smartbot-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Badge de fuente Gemini AI */
.smartbot-gemini-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(147, 51, 234, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #c084fc;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
}

/* Panel de Ajustes / Clave API de Gemini */
.smartbot-settings-panel {
    position: absolute;
    inset: 60px 12px 12px 12px;
    background: rgba(10, 15, 30, 0.97);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 18px;
    z-index: 100050;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    animation: smartbot-fade-in 0.25s ease-out;
}

.smartbot-settings-title {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.smartbot-settings-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.smartbot-settings-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.smartbot-settings-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.smartbot-settings-btn-save {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    border: none;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.smartbot-settings-btn-save:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
}

