/**
 * NEUROLAKE - Chatbot Widget Styles
 * Estilo Tech/Futurista que combina con el sitio
 */

/* Variables - Usando los colores del sitio */
:root {
    --chat-bg-primary: #000000;
    --chat-bg-secondary: #0a0a0a;
    --chat-bg-tertiary: #111111;
    --chat-bg-card: rgba(255, 255, 255, 0.03);
    --chat-border: rgba(255, 255, 255, 0.08);
    --chat-border-hover: rgba(255, 255, 255, 0.15);
    --chat-text-primary: #ffffff;
    --chat-text-secondary: rgba(255, 255, 255, 0.7);
    --chat-text-muted: rgba(255, 255, 255, 0.5);
    --chat-accent-blue: #3b82f6;
    --chat-accent-purple: #8b5cf6;
    --chat-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --chat-glow-blue: rgba(59, 130, 246, 0.3);
    --chat-glow-purple: rgba(139, 92, 246, 0.3);
}

/* Botón flotante del chat - Estilo tech con gradiente */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--chat-gradient);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    box-shadow: 
        0 0 30px var(--chat-glow-blue),
        0 0 60px var(--chat-glow-purple),
        0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 16px;
}

.chatbot-toggle:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 0 40px var(--chat-glow-blue),
        0 0 80px var(--chat-glow-purple),
        0 30px 60px rgba(0, 0, 0, 0.5);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.4s ease;
    position: relative;
    z-index: 1;
}

.chatbot-toggle.active svg {
    transform: rotate(180deg);
}

/* Indicador de notificación - Estilo tech */
.chatbot-toggle::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--chat-gradient);
    border-radius: 50%;
    border: 2px solid var(--chat-bg-primary);
    animation: pulse-glow 2s infinite;
    z-index: 2;
}

.chatbot-toggle.active::after {
    display: none;
}

@keyframes pulse-glow {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 var(--chat-glow-blue);
    }
    50% { 
        transform: scale(1.1); 
        box-shadow: 0 0 20px 5px var(--chat-glow-purple);
    }
}

/* Contenedor principal del chat */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 140px);
    background: var(--chat-bg-primary);
    border-radius: 20px;
    box-shadow: 
        0 0 40px rgba(59, 130, 246, 0.1),
        0 0 80px rgba(139, 92, 246, 0.05),
        0 25px 80px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--chat-border);
    backdrop-filter: blur(20px);
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header del chat - Estilo futurista */
.chatbot-header {
    background: var(--chat-bg-secondary);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--chat-border);
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--chat-gradient);
    opacity: 0.5;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--chat-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 0 20px var(--chat-glow-blue);
}

.chatbot-avatar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
    border-radius: 14px;
}

.chatbot-avatar svg {
    width: 26px;
    height: 26px;
    fill: white;
    position: relative;
    z-index: 1;
}

.chatbot-info {
    flex: 1;
}

.chatbot-name {
    font-family: 'Syne', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.chatbot-status {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: var(--chat-accent-blue);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--chat-accent-blue);
    border-radius: 50%;
    animation: status-pulse 2s infinite;
    box-shadow: 0 0 10px var(--chat-glow-blue);
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.chatbot-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--chat-border-hover);
    transform: rotate(90deg);
}

.chatbot-close svg {
    width: 16px;
    height: 16px;
    fill: var(--chat-text-muted);
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: 
        radial-gradient(ellipse at top, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-border-hover);
}

/* Mensajes */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: messageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-message.assistant .message-avatar {
    background: var(--chat-gradient);
    box-shadow: 0 0 15px var(--chat-glow-blue);
}

.chat-message.assistant .message-avatar svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.chat-message.user .message-avatar {
    background: var(--chat-bg-tertiary);
    border: 1px solid var(--chat-border);
}

.chat-message.user .message-avatar svg {
    width: 16px;
    height: 16px;
    fill: var(--chat-text-muted);
}

.message-content {
    padding: 14px 18px;
    border-radius: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.assistant .message-content {
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border);
    color: var(--chat-text-secondary);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
    background: var(--chat-gradient);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 0 20px var(--chat-glow-blue);
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chat-accent-blue);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
    box-shadow: 0 0 10px var(--chat-glow-blue);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
    background: var(--chat-accent-purple);
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% { 
        transform: translateY(0); 
        opacity: 0.5;
    }
    30% { 
        transform: translateY(-10px); 
        opacity: 1;
    }
}

/* Input del chat */
.chatbot-input {
    padding: 16px 20px;
    background: var(--chat-bg-secondary);
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chatbot-input textarea {
    flex: 1;
    background: var(--chat-bg-primary);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--chat-text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 48px;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.chatbot-input textarea::placeholder {
    color: var(--chat-text-muted);
}

.chatbot-input textarea:focus {
    outline: none;
    border-color: var(--chat-accent-blue);
    box-shadow: 0 0 20px var(--chat-glow-blue);
}

.chatbot-send {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--chat-gradient);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px var(--chat-glow-blue);
}

.chatbot-send::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 12px;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--chat-glow-blue), 0 0 40px var(--chat-glow-purple);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: white;
    position: relative;
    z-index: 1;
}

/* Quick replies - Estilo tech */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 16px;
}

.quick-reply {
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border);
    color: var(--chat-text-secondary);
    padding: 10px 16px;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply:hover {
    background: var(--chat-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--chat-glow-blue);
}

/* Efecto de línea de escaneo tech */
.chatbot-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(
        transparent 0%,
        rgba(59, 130, 246, 0.03) 50%,
        transparent 100%
    );
    animation: scanline 8s linear infinite;
    pointer-events: none;
    opacity: 0.5;
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }

    .chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .chatbot-input {
        padding: 12px 16px;
    }

    .quick-replies {
        padding: 0 16px 12px;
    }
}

/* Efecto de borde brillante en hover */
.chatbot-container:hover {
    border-color: var(--chat-border-hover);
}

/* Grid pattern de fondo sutil */
.chatbot-messages::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.5;
}
