/* ================================================================
   THUNDERBOT ELITE UI - ESTILO PESTAÑA INTELIGENTE (3 ESTADOS)
   ================================================================ */

#thunderbot-wrapper {
    position: fixed;
    bottom: 180px !important; 
    right: 0;
    z-index: 10002;
    font-family: 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none; /* Evita que el wrapper vacío bloquee clics */
}

/* --- LANZADOR TIPO PESTAÑA CON ESTADOS --- */
#thunderbot-launcher {
    pointer-events: auto; /* Reactiva los clics en el botón */
    background: #0F172A;
    padding: 12px;
    border-radius: 40px 0 0 40px;
    cursor: pointer;
    box-shadow: -4px 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    display: flex;
    align-items: center;
    border: 1.5px solid rgba(255, 215, 0, 0.2);
    border-right: none;
}

/* ESTADO 1: Tucked (Metido en el borde) */
#thunderbot-launcher.ts-tucked {
    transform: translateX(55%); /* Esconde la mitad del logo */
}

/* ESTADO 2: Expanded (Se muestra el texto) */
#thunderbot-launcher.ts-expanded {
    transform: translateX(0);
    padding-left: 20px;
}

.ts-launcher-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- EFECTO RAYO (PULSO DE ENERGÍA) --- */
@keyframes ts-lightning-pulse {
    0% { filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.4)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.8)); transform: scale(1.05); }
    100% { filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.4)); transform: scale(1); }
}

.ts-launcher-icon img {
    width: 35px;
    height: 35px;
    display: block;
    animation: ts-lightning-pulse 2s infinite ease-in-out;
}

/* Lógica del texto (Oculto hasta que se expanda) */
.ts-launcher-text {
    color: white;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

#thunderbot-launcher.ts-expanded .ts-launcher-text {
    opacity: 1;
    max-width: 250px;
}

/* --- VENTANA DE CHAT GLASSMORPHISM (SIN CAMBIOS) --- */
#thunderbot-window {
    display: none;
    pointer-events: auto;
    width: 320px;
    height: 480px;
    margin-right: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 24px;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.ts-bot-header {
    background: #0F172A;
    color: white;
    padding: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ts-bot-header h3 { margin: 0; font-size: 17px; color: #FFD700; font-weight: 700; }
.ts-bot-header p { margin: 0; font-size: 11px; opacity: 0.8; }
.ts-bot-status { font-size: 9px; color: #4ADE80; display: block; margin-bottom: 3px; font-weight: bold; }

#ts-bot-close { 
    background: rgba(255,255,255,0.1); 
    border: none; 
    color: white; 
    font-size: 20px; 
    cursor: pointer; 
    width: 30px; 
    height: 30px; 
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ts-bot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ts-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
}

.ts-msg-bot { background: white; color: #1e293b; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.ts-msg-user { background: #0F172A; color: white; align-self: flex-end; border-bottom-right-radius: 4px; }

.ts-bot-input-area { padding: 15px; display: flex; gap: 10px; background: white; border-top: 1px solid #f1f5f9; }
#ts-bot-input { flex: 1; border: 1px solid #e2e8f0; padding: 12px 15px; border-radius: 14px; outline: none; font-size: 14px; background: #f8fafc; }

#ts-bot-send {
    background: #0F172A;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0; /* Importante para que el icono no se desplace */
}

#ts-bot-send:hover {
    background: #1e293b;
    transform: scale(1.05);
}

/* AQUÍ ESTÁ EL ARREGLO DEL ICONO */
#ts-bot-send svg {
    width: 24px !important;
    height: 24px !important;
    fill: #FFD700 !important; /* El dorado de tu marca */
    display: block;
}

/* Botones de productos dentro del chat */
.ts-link-button {
    display: inline-block;
    background: #FFD700; /* Dorado Thunder */
    color: #0F172A !important; /* Azul oscuro */
    padding: 8px 15px;
    margin-top: 10px;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
    transition: all 0.2s ease;
}

.ts-link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.4);
    background: #ffea00;
}

/* Contenedor de la Tarjeta de Producto */
.ts-product-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.ts-product-card:hover {
    transform: translateY(-5px);
}

/* Imagen del Producto */
.ts-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-bottom: 2px solid #FFD700;
}

/* Info de la Tarjeta */
.ts-card-body {
    padding: 12px;
    text-align: center;
}

.ts-card-title {
    font-size: 14px;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 5px;
    display: block;
}

.ts-card-price {
    font-size: 13px;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

/* Botón de la Tarjeta (Reutilizamos tu estilo de botón) */
.ts-card-btn {
    display: block;
    background: #0F172A;
    color: #FFD700 !important;
    text-decoration: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    transition: all 0.2s;
}

.ts-card-btn:hover {
    background: #FFD700;
    color: #0F172A !important;
}

#ts-bot-clear {
    transition: all 0.3s ease;
    font-size: 14px;
}

#ts-bot-clear:hover {
    color: #ff4d4d; /* Un rojo suave para indicar borrar */
    transform: scale(1.2);
}