/**
 * TAZDUCA CHATBOT ULTRA PREMIUM
 * Diseño de clase mundial con animaciones premium y funcionalidad perfecta
 */

/* ============================================
   VARIABLES CSS PREMIUM
   ============================================ */
:root {
    --chatbot-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chatbot-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --chatbot-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --chatbot-success: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --chatbot-shadow-light: 0 4px 20px rgba(102, 126, 234, 0.1);
    --chatbot-shadow-medium: 0 8px 32px rgba(102, 126, 234, 0.2);
    --chatbot-shadow-heavy: 0 16px 48px rgba(102, 126, 234, 0.3);
    --chatbot-glass: rgba(255, 255, 255, 0.25);
    --chatbot-border: rgba(255, 255, 255, 0.18);
    --chatbot-text-primary: #2d3748;
    --chatbot-text-secondary: #4a5568;
    --chatbot-text-light: rgba(255, 255, 255, 0.9);
}

/* ============================================
   RESET Y BASE STYLES
   ============================================ */
#tazduca-chatbot,
#tazduca-chatbot *,
#tazduca-chatbot *::before,
#tazduca-chatbot *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   CONTENEDOR PRINCIPAL ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot.chatbot-container {
    position: fixed !important;
    bottom: 100px !important;
    right: 24px !important;
    width: 400px !important;
    height: 650px !important;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.95) 50%,
        rgba(241, 245, 249, 0.95) 100%) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-radius: 24px !important;
    box-shadow: 
        0 32px 64px rgba(102, 126, 234, 0.12),
        0 16px 32px rgba(102, 126, 234, 0.08),
        0 8px 16px rgba(102, 126, 234, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 0 0 1px rgba(102, 126, 234, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 999999 !important;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    transform-origin: bottom right !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#tazduca-chatbot.chatbot-container.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.8) translateY(20px) !important;
    pointer-events: none !important;
}

#tazduca-chatbot.chatbot-container.minimized {
    height: 80px !important;
    cursor: pointer !important;
    transform: translateY(0) !important;
}

#tazduca-chatbot.chatbot-container.minimized .chatbot-messages,
#tazduca-chatbot.chatbot-container.minimized .chatbot-input-area {
    opacity: 0 !important;
    pointer-events: none !important;
}

#tazduca-chatbot.chatbot-container.minimized .chatbot-header {
    border-radius: 24px !important;
}

/* ============================================
   HEADER ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .chatbot-header {
    background: var(--chatbot-primary) !important;
    padding: 20px 24px !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    min-height: 80px !important;
    position: relative !important;
    border-radius: 24px 24px 0 0 !important;
    overflow: hidden !important;
}

#tazduca-chatbot .chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
}

#tazduca-chatbot .chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
}

/* ============================================
   AVATAR ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .chatbot-avatar {
    width: 52px !important;
    height: 52px !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border-radius: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    flex-shrink: 0 !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

#tazduca-chatbot .chatbot-avatar::before {
    content: 'T';
    position: absolute;
    font-size: 28px;
    font-weight: 800;
    background: var(--chatbot-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

#tazduca-chatbot .chatbot-avatar img {
    width: 32px !important;
    height: 32px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
}

#tazduca-chatbot .status-indicator {
    position: absolute !important;
    bottom: -2px !important;
    right: -2px !important;
    width: 16px !important;
    height: 16px !important;
    background: var(--chatbot-success) !important;
    border: 3px solid white !important;
    border-radius: 50% !important;
    animation: statusPulse 2s infinite !important;
}

@keyframes statusPulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(67, 233, 123, 0.4); 
    }
    50% { 
        transform: scale(1.1); 
        box-shadow: 0 0 0 8px rgba(67, 233, 123, 0); 
    }
}

/* ============================================
   INFO SECTION ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .chatbot-info {
    flex: 1 !important;
    color: var(--chatbot-text-light) !important;
    z-index: 1 !important;
}

#tazduca-chatbot .chatbot-info h3 {
    font-size: 18px !important;
    font-weight: 700 !important;
    margin: 0 0 4px 0 !important;
    color: white !important;
    letter-spacing: -0.025em !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

#tazduca-chatbot .chatbot-info .status-text {
    font-size: 13px !important;
    opacity: 0.92 !important;
    margin: 0 !important;
    color: var(--chatbot-text-light) !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

#tazduca-chatbot .chatbot-info .status-text::before {
    content: '●';
    color: #43e97b;
    font-size: 12px;
    animation: statusBlink 2s infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   CONTROLES ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .chatbot-controls {
    display: flex !important;
    gap: 8px !important;
    z-index: 1 !important;
}

#tazduca-chatbot .chatbot-controls button {
    width: 36px !important;
    height: 36px !important;
    border-radius: 12px !important;
    background: var(--chatbot-glass) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid var(--chatbot-border) !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    position: relative !important;
    overflow: hidden !important;
}

#tazduca-chatbot .chatbot-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#tazduca-chatbot .chatbot-controls button:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

#tazduca-chatbot .chatbot-controls button:hover::before {
    left: 100%;
}

#tazduca-chatbot .chatbot-controls button:active {
    transform: translateY(0) scale(0.95) !important;
}

#tazduca-chatbot .chatbot-controls button i {
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

#tazduca-chatbot .chatbot-controls button:hover i {
    transform: scale(1.1) !important;
}

/* ============================================
   MENSAJES ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .chatbot-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 24px !important;
    background: linear-gradient(180deg, 
        rgba(248, 250, 252, 0.3) 0%, 
        rgba(241, 245, 249, 0.5) 100%) !important;
    scroll-behavior: smooth !important;
    transition: all 0.3s ease !important;
}

/* Scrollbar Ultra Premium */
#tazduca-chatbot .chatbot-messages::-webkit-scrollbar {
    width: 8px !important;
}

#tazduca-chatbot .chatbot-messages::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.05) !important;
    border-radius: 4px !important;
    margin: 8px 0 !important;
}

#tazduca-chatbot .chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-primary) !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

#tazduca-chatbot .chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chatbot-secondary) !important;
}

/* Mensajes */
#tazduca-chatbot .message {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 16px !important;
    animation: messageSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#tazduca-chatbot .bot-message {
    justify-content: flex-start !important;
}

#tazduca-chatbot .user-message {
    justify-content: flex-end !important;
}

#tazduca-chatbot .message-content {
    max-width: 80% !important;
    padding: 16px 20px !important;
    border-radius: 20px !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    word-wrap: break-word !important;
    position: relative !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

#tazduca-chatbot .bot-message .message-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    color: var(--chatbot-text-primary) !important;
    border: 1px solid rgba(102, 126, 234, 0.08) !important;
    box-shadow: var(--chatbot-shadow-light) !important;
    border-bottom-left-radius: 8px !important;
}

#tazduca-chatbot .bot-message .message-content:hover {
    box-shadow: var(--chatbot-shadow-medium) !important;
    transform: translateY(-1px) !important;
}

#tazduca-chatbot .user-message .message-content {
    background: var(--chatbot-primary) !important;
    color: white !important;
    box-shadow: var(--chatbot-shadow-medium) !important;
    border-bottom-right-radius: 8px !important;
}

#tazduca-chatbot .user-message .message-content:hover {
    box-shadow: var(--chatbot-shadow-heavy) !important;
    transform: translateY(-2px) !important;
}

/* Welcome Message Ultra Premium */
#tazduca-chatbot .welcome-message .message-content {
    max-width: 100% !important;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.03) 0%, 
        rgba(118, 75, 162, 0.03) 100%) !important;
    border: 1px solid rgba(102, 126, 234, 0.12) !important;
    backdrop-filter: blur(10px) !important;
}

/* Quick Actions Ultra Premium */
#tazduca-chatbot .quick-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 12px !important;
}

#tazduca-chatbot .quick-action {
    padding: 10px 16px !important;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%) !important;
    border: 1px solid rgba(102, 126, 234, 0.15) !important;
    border-radius: 20px !important;
    color: #667eea !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    position: relative !important;
    overflow: hidden !important;
}

#tazduca-chatbot .quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--chatbot-primary);
    transition: left 0.3s ease;
    z-index: -1;
}

#tazduca-chatbot .quick-action:hover {
    color: white !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: var(--chatbot-shadow-medium) !important;
}

#tazduca-chatbot .quick-action:hover::before {
    left: 0;
}

/* ============================================
   INPUT AREA ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .chatbot-input-area {
    padding: 20px !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border-top: 1px solid rgba(102, 126, 234, 0.08) !important;
    backdrop-filter: blur(20px) !important;
}

#tazduca-chatbot .input-container {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    border-radius: 28px !important;
    padding: 6px 6px 6px 20px !important;
    border: 2px solid transparent !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    position: relative !important;
    overflow: hidden !important;
}

#tazduca-chatbot .input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.05) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#tazduca-chatbot .input-container:focus-within {
    background: white !important;
    border-color: #667eea !important;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.08),
        var(--chatbot-shadow-light) !important;
    transform: translateY(-2px) !important;
}

#tazduca-chatbot .input-container:focus-within::before {
    opacity: 1;
}

#tazduca-chatbot #chatbot-input {
    flex: 1 !important;
    border: none !important;
    background: transparent !important;
    outline: none !important;
    font-size: 15px !important;
    color: var(--chatbot-text-primary) !important;
    padding: 12px 0 !important;
    font-family: inherit !important;
    font-weight: 500 !important;
}

#tazduca-chatbot #chatbot-input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400 !important;
}

/* ============================================
   BOTÓN DE ENVIAR ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot #chatbot-send {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: var(--chatbot-primary) !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: var(--chatbot-shadow-light) !important;
}

#tazduca-chatbot #chatbot-send::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

#tazduca-chatbot #chatbot-send:hover {
    transform: scale(1.1) translateY(-2px) !important;
    box-shadow: var(--chatbot-shadow-heavy) !important;
    background: var(--chatbot-secondary) !important;
}

#tazduca-chatbot #chatbot-send:hover::before {
    width: 100%;
    height: 100%;
}

#tazduca-chatbot #chatbot-send:active {
    transform: scale(0.95) translateY(0) !important;
}

#tazduca-chatbot #chatbot-send i {
    font-size: 18px !important;
    z-index: 1 !important;
    transition: all 0.2s ease !important;
}

#tazduca-chatbot #chatbot-send:hover i {
    transform: scale(1.1) rotate(15deg) !important;
}

/* ============================================
   BOTÓN FLOTANTE ULTRA PREMIUM
   ============================================ */
#chatbot-toggle {
    position: fixed !important;
    bottom: 32px !important;
    right: 32px !important;
    width: 64px !important;
    height: 64px !important;
    background: var(--chatbot-primary) !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: var(--chatbot-shadow-heavy) !important;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    z-index: 999998 !important;
    overflow: hidden !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

#chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(from 0deg, #667eea, #764ba2, #667eea);
    border-radius: 22px;
    z-index: -1;
    animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#chatbot-toggle:hover {
    transform: scale(1.1) translateY(-4px) rotate(5deg) !important;
    box-shadow: 
        0 20px 60px rgba(102, 126, 234, 0.4),
        0 0 40px rgba(102, 126, 234, 0.2) !important;
}

#chatbot-toggle.active {
    opacity: 0 !important;
    transform: scale(0) rotate(180deg) !important;
    pointer-events: none !important;
}

#chatbot-toggle i {
    font-size: 28px !important;
    color: white !important;
    z-index: 1 !important;
    transition: all 0.3s ease !important;
}

#chatbot-toggle:hover i {
    transform: scale(1.2) !important;
}

/* ============================================
   TYPING INDICATOR ULTRA PREMIUM
   ============================================ */
#tazduca-chatbot .typing-indicator .message-content {
    padding: 20px !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
}

#tazduca-chatbot .typing-dots {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
}

#tazduca-chatbot .typing-dots span {
    width: 10px !important;
    height: 10px !important;
    background: var(--chatbot-primary) !important;
    border-radius: 50% !important;
    animation: typingBounce 1.6s infinite !important;
}

#tazduca-chatbot .typing-dots span:nth-child(2) {
    animation-delay: 0.2s !important;
}

#tazduca-chatbot .typing-dots span:nth-child(3) {
    animation-delay: 0.4s !important;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-12px) scale(1.1);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE ULTRA PREMIUM
   ============================================ */
@media (max-width: 480px) {
    #tazduca-chatbot.chatbot-container {
        width: calc(100% - 16px) !important;
        height: calc(100% - 16px) !important;
        bottom: 8px !important;
        right: 8px !important;
        left: 8px !important;
        border-radius: 20px !important;
    }
    
    #chatbot-toggle {
        bottom: 24px !important;
        right: 24px !important;
        width: 60px !important;
        height: 60px !important;
    }
    
    #tazduca-chatbot #chatbot-input {
        font-size: 16px !important;
    }
    
    #tazduca-chatbot .message-content {
        max-width: 85% !important;
        font-size: 14px !important;
    }
}

/* ============================================
   ANIMACIONES ESPECIALES
   ============================================ */
@keyframes chatbotEnter {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(40px) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0) rotate(0deg);
    }
}

#tazduca-chatbot.chatbot-container:not(.hidden) {
    animation: chatbotEnter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* Efectos de partículas opcionales */
#tazduca-chatbot .chatbot-header::after {
    content: '';
    position: absolute;
    top: 20%;
    right: 10%;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: floatingParticle 4s infinite;
}

@keyframes floatingParticle {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --chatbot-text-primary: #f1f5f9;
        --chatbot-text-secondary: #cbd5e1;
    }
    
    #tazduca-chatbot.chatbot-container {
        background: linear-gradient(135deg, 
            rgba(30, 41, 59, 0.95) 0%, 
            rgba(15, 23, 42, 0.95) 100%) !important;
    }
    
    #tazduca-chatbot .bot-message .message-content {
        background: linear-gradient(135deg, #334155 0%, #475569 100%) !important;
        color: #f1f5f9 !important;
    }
    
    #tazduca-chatbot .chatbot-input-area {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    }
}