/* AI Chat Widget — Dark Theme */

#ai-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.ai-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue, #60a5fa), var(--accent-purple, #a78bfa));
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-toggle-btn svg {
    width: 26px;
    height: 26px;
}

.ai-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(96, 165, 250, 0.5);
}

.ai-toggle-btn.active {
    background: linear-gradient(135deg, var(--accent-purple, #a78bfa), var(--accent-blue, #60a5fa));
}

.ai-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-height: 500px;
    background: var(--surface-dark, #1a1a2e);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ai-slideUp 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-panel.hidden {
    display: none;
}

@keyframes ai-slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(167, 139, 250, 0.15));
    color: var(--text-primary, #f0f0f5);
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-close-btn {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary, #a0a0b8);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.ai-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-height: 350px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface-darker, #12121f);
}

.ai-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.6;
    font-size: 0.9rem;
}

.ai-message-user {
    background: linear-gradient(135deg, var(--accent-blue, #60a5fa), var(--accent-purple, #a78bfa));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant {
    background: var(--surface-dark, #1a1a2e);
    color: var(--text-primary, #f0f0f5);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-message code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 0.85em;
}

.ai-loading {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.ai-loading .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-blue, #60a5fa);
    border-radius: 50%;
    animation: ai-bounce 1.4s infinite ease-in-out;
}

.ai-loading .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-loading .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes ai-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.ai-input-area {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: var(--surface-dark, #1a1a2e);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    background: var(--surface-darker, #12121f);
    color: var(--text-primary, #f0f0f5);
    transition: border-color 0.2s;
}

#ai-chat-input:focus {
    border-color: var(--accent-blue, #60a5fa);
}

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

.ai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue, #60a5fa), var(--accent-purple, #a78bfa));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-send-btn svg {
    width: 20px;
    height: 20px;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(96, 165, 250, 0.4);
}

/* Mobile */
@media (max-width: 480px) {
    .ai-panel {
        width: calc(100vw - 48px);
        max-height: 60vh;
    }
}

/* Print: hide */
@media print {
    #ai-chat-widget {
        display: none !important;
    }
}