/**
 * GLOBAL AI ASSISTANT - ESTILOS
 * Widget flotante con diseño oscuro y animaciones
 */

#ai-assistant-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* TOGGLE BUTTON */
.ai-widget-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lime-primary, #c4d600) 0%, var(--lime-light, #dceb50) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(196, 214, 0, 0.4);
    transition: all 0.3s ease;
    font-size: 24px;
    position: relative;
    z-index: 10000;
    user-select: none;
}

.ai-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(196, 214, 0, 0.6);
}

.ai-widget-toggle:active {
    transform: scale(0.95);
}

/* Pulso de disponibilidad */
.ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--lime-primary, #c4d600);
    animation: ai-pulse-animation 2s infinite;
}

@keyframes ai-pulse-animation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* CHAT WINDOW */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: var(--bg-primary, #0a0e27);
    border: 1px solid rgba(196, 214, 0, 0.2);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    animation: ai-slide-in 0.3s ease-out;
}

@keyframes ai-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-window.hidden {
    display: none !important;
}

/* HEADER */
.ai-chat-header {
    padding: 16px;
    border-bottom: 1px solid rgba(196, 214, 0, 0.1);
    background: linear-gradient(135deg, rgba(196, 214, 0, 0.05) 0%, rgba(220, 235, 80, 0.02) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    color: var(--text-primary, #e0e0e0);
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-header h3::before {
    content: '🤖';
    font-size: 18px;
}

.ai-header-actions {
    display: flex;
    gap: 8px;
}

/* BUTTONS */
.ai-btn-small,
.ai-btn-close {
    background: rgba(196, 214, 0, 0.1);
    border: 1px solid rgba(196, 214, 0, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-primary, #e0e0e0);
    transition: all 0.2s ease;
    font-size: 14px;
}

.ai-btn-small:hover,
.ai-btn-close:hover {
    background: rgba(196, 214, 0, 0.2);
    border-color: rgba(196, 214, 0, 0.4);
}

.ai-btn-close {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CHAT BODY */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary, #0a0e27);
}

.ai-chat-body::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: rgba(196, 214, 0, 0.05);
    border-radius: 3px;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(196, 214, 0, 0.2);
    border-radius: 3px;
}

.ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 214, 0, 0.3);
}

/* MESSAGES */
.ai-message {
    display: flex;
    animation: ai-message-appear 0.3s ease-out;
}

@keyframes ai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.ai-user {
    justify-content: flex-end;
}

.ai-message.ai-bot {
    justify-content: flex-start;
}

.ai-msg-content {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-message.ai-user .ai-msg-content {
    background: linear-gradient(135deg, var(--lime-primary, #c4d600) 0%, var(--lime-light, #dceb50) 100%);
    color: var(--bg-primary, #0a0e27);
    font-weight: 500;
}

.ai-message.ai-bot .ai-msg-content {
    background: rgba(196, 214, 0, 0.08);
    border: 1px solid rgba(196, 214, 0, 0.15);
    color: var(--text-primary, #e0e0e0);
}

.ai-msg-content strong {
    color: var(--lime-primary, #c4d600);
    font-weight: 600;
}

.ai-message.ai-user .ai-msg-content strong {
    color: var(--bg-primary, #0a0e27);
}

/* FOOTER / INPUT */
.ai-chat-footer {
    padding: 12px;
    border-top: 1px solid rgba(196, 214, 0, 0.1);
    background: rgba(196, 214, 0, 0.02);
    display: flex;
    gap: 8px;
}

.ai-input {
    flex: 1;
    padding: 10px 12px;
    background: rgba(196, 214, 0, 0.05);
    border: 1px solid rgba(196, 214, 0, 0.2);
    border-radius: 8px;
    color: var(--text-primary, #e0e0e0);
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
}

.ai-input::placeholder {
    color: var(--text-muted, #888);
}

.ai-input:focus {
    background: rgba(196, 214, 0, 0.1);
    border-color: rgba(196, 214, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(196, 214, 0, 0.1);
}

.ai-btn-send {
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--lime-primary, #c4d600) 0%, var(--lime-light, #dceb50) 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--bg-primary, #0a0e27);
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 214, 0, 0.3);
}

.ai-btn-send:active {
    transform: translateY(0);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    #ai-assistant-widget {
        bottom: 15px;
        right: 15px;
    }

    .ai-widget-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .ai-chat-window {
        width: 320px;
        height: 450px;
        bottom: 70px;
    }

    .ai-msg-content {
        max-width: 90%;
        font-size: 13px;
        padding: 10px 12px;
    }

    .ai-chat-header h3 {
        font-size: 15px;
    }

    .ai-input {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #ai-assistant-widget {
        bottom: 10px;
        right: 10px;
    }

    .ai-widget-toggle {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }

    .ai-chat-window {
        width: 95vw;
        height: 60vh;
        max-width: 320px;
        bottom: 65px;
        right: 50%;
        transform: translateX(50%);
    }

    .ai-chat-body {
        padding: 12px;
    }

    .ai-msg-content {
        max-width: 85%;
        padding: 8px 10px;
        font-size: 12px;
    }

    .ai-chat-header h3 {
        font-size: 14px;
    }

    .ai-header-actions {
        gap: 4px;
    }

    .ai-btn-small,
    .ai-btn-close {
        padding: 4px 8px;
        font-size: 12px;
    }

    .ai-chat-footer {
        padding: 10px;
        gap: 6px;
    }

    .ai-input {
        padding: 8px 10px;
        font-size: 12px;
    }

    .ai-btn-send {
        padding: 8px 12px;
    }
}

/* ANIMACIONES DE CARGA */
@keyframes ai-typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

.ai-typing {
    display: flex;
    gap: 4px;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lime-primary, #c4d600);
    animation: ai-typing 1.4s infinite;
}

.ai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}
