/* ==========================================================================
   WIDGET DE CHAT PREMIUM - ESTILOS (chat-widget.css)
   Amazing Box Wholesale - Tema Oscuro & Glassmorphism (Robotito Widget)
   ========================================================================== */

/* Fuentes e Iconografía */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Variables CSS */
:root {
    --ab-primary: #d85600; /* Softer, richer brand orange matching the logo */
    --ab-primary-light: #ff8533;
    --ab-accent: #000000;
    --ab-bg-dark: #0a0a0a;
    --ab-bg-panel: rgba(10, 10, 10, 0.96);
    --ab-border: rgba(255, 255, 255, 0.1);
    --ab-border-hover: rgba(255, 255, 255, 0.18);
    --ab-text-main: #ffffff;
    --ab-text-muted: #a3a3a3;
    --ab-text-dark: #737373;
    --ab-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
    --ab-shadow-glow: 0 0 30px rgba(216, 86, 0, 0.25);
    
    --ab-font: 'Outfit', sans-serif;
}

/* Burbuja Flotante de Lanzamiento (Trigger Robotito Caja) */
#ab-chat-trigger {
    position: fixed;
    bottom: 20px;
    right: 25px;
    width: 90px;
    height: 135px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: abRobotHover 3.5s ease-in-out infinite;
}

#ab-chat-trigger:hover {
    transform: scale(1.06) translateY(-4px);
    animation-play-state: paused;
}

#ab-chat-trigger-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
    transform: perspective(400px) rotateY(0deg);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
}

#ab-chat-trigger:hover #ab-chat-trigger-img {
    transform: perspective(400px) rotateY(-360deg);
    filter: drop-shadow(0 12px 24px rgba(216, 86, 0, 0.65));
}

#ab-chat-trigger.active {
    animation: none;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* Luz parpadeante de la antena del robotito */
#ab-robot-antenna-glow {
    position: absolute;
    top: 8.5%; /* Coordenada vertical de la punta de la antena ajustada en base a captura */
    left: 65.5%; /* Coordenada horizontal de la punta de la antena en el 3D */
    transform: translate(-50%, -50%);
    width: 7px; /* Achicado a 7px */
    height: 7px; /* Achicado a 7px */
    background-color: #ffeb3b; /* Amarillo neon intermitente */
    border-radius: 50%;
    z-index: 100000;
    pointer-events: none;
    animation: abAntennaBlink 1.5s ease-in-out infinite;
}

@keyframes abAntennaBlink {
    0%, 100% {
        opacity: 0.35;
        box-shadow: 0 0 3px rgba(255, 235, 59, 0.4), 0 0 6px rgba(255, 235, 59, 0.2);
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(255, 235, 59, 1), 0 0 18px rgba(255, 235, 59, 0.8);
        transform: translate(-50%, -50%) scale(1.1);
    }
}


/* Cartelito de Diálogo encima del Robot (Speech Bubble) */
#ab-chat-bubble-promo {
    position: absolute;
    top: -33px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--ab-primary), var(--ab-primary-light));
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(216, 86, 0, 0.35);
    z-index: 1000000;
    pointer-events: none;
    animation: abBubblePulse 2.5s ease-in-out infinite;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Triángulo del cartelito de diálogo */
#ab-chat-bubble-promo::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--ab-primary-light);
}

/* Animación de latido y flotación del cartelito (achicar y agrandar) */
@keyframes abBubblePulse {
    0%, 100% {
        transform: translate(-50%, 0) scale(1);
    }
    50% {
        transform: translate(-50%, -6px) scale(1.08);
    }
}

/* Orejas del Robot - Eliminadas */
#ab-chat-trigger::before {
    display: none;
}

/* Antena del Robot - Eliminada */
#ab-chat-trigger::after {
    display: none;
}

/* Animación de levitación del Robot */
@keyframes abRobotHover {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Contenedor del Panel de Chat */
#ab-chat-panel {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 150px);
    background-color: var(--ab-bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ab-border);
    border-radius: 20px;
    box-shadow: var(--ab-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999998;
    font-family: var(--ab-font);
    color: var(--ab-text-main);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

#ab-chat-panel.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Cabecera del Panel */
.ab-chat-header {
    padding: 20px;
    background: linear-gradient(to right, rgba(255, 105, 0, 0.15), rgba(0, 0, 0, 0.4));
    border-bottom: 2px solid var(--ab-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ab-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ab-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff;
    border: 1.5px solid var(--ab-primary);
}

.ab-header-title h3 {
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 2px;
}

.ab-header-title span {
    font-size: 0.75em;
    color: var(--ab-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ab-online-indicator {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.ab-chat-close {
    background: none;
    border: none;
    color: var(--ab-text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.2s ease;
}

.ab-chat-close:hover {
    color: var(--ab-text-main);
}

/* Cuerpo de Mensajes */
.ab-chat-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Estilo de los Mensajes */
.ab-msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

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

.ab-msg-wrapper.model {
    align-self: flex-start;
}

.ab-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9em;
    line-height: 1.5;
}

.ab-msg-wrapper.user .ab-msg-bubble {
    background: linear-gradient(135deg, var(--ab-primary), #d85600);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.ab-msg-wrapper.model .ab-msg-bubble {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--ab-border);
    color: var(--ab-text-main);
    border-bottom-left-radius: 4px;
}

.ab-msg-time {
    font-size: 0.7em;
    color: var(--ab-text-dark);
    margin-top: 4px;
    align-self: flex-end;
}

.ab-msg-wrapper.model .ab-msg-time {
    align-self: flex-start;
}

/* Animación de entrada para mensajes */
@keyframes slideIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ab-msg-wrapper {
    animation: slideIn 0.25s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

/* Indicador de Escritura (Typing Loader) */
.ab-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
}

.ab-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--ab-text-muted);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.ab-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.ab-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Zona de Entrada de Texto */
.ab-chat-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--ab-border);
    background-color: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ab-input-container {
    flex-grow: 1;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ab-border);
    border-radius: 12px;
    padding: 2px 12px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.ab-input-container:focus-within {
    border-color: var(--ab-primary-light);
    box-shadow: 0 0 0 2px rgba(255, 105, 0, 0.25);
}

.ab-chat-input {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    color: var(--ab-text-main);
    font-family: var(--ab-font);
    font-size: 0.9em;
    padding: 10px 0;
}

.ab-chat-input::placeholder {
    color: var(--ab-text-dark);
}

.ab-btn-send {
    background: none;
    border: none;
    color: var(--ab-primary-light);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: all 0.2s ease;
}

.ab-btn-send:hover {
    color: var(--ab-text-main);
    transform: scale(1.1);
}

.ab-btn-send:active {
    transform: scale(0.95);
}

/* Responsive para Móviles */
@media (max-width: 480px) {
    #ab-chat-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    
    #ab-chat-trigger {
        bottom: 20px;
        right: 20px;
    }
}
