/* AI Chat Panel - Premium Glassmorphism Design */

/* Base Panel Styling */
#ai-chat-panel {
    position: fixed;
    z-index: 9999;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    box-shadow:
        0 20px 50px -10px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    visibility: hidden;
}

/* Open State */
#ai-chat-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    visibility: visible;
}

/* --- Modes --- */

/* 1. Default Mode (Floating Window) */
#ai-chat-panel.mode-default {
    bottom: 7rem;
    /* Increased slightly to clear launcher area */
    right: 2rem;
    width: 400px;
    height: 600px;
    border-radius: 1.5rem;
}

/* 2. Minimized Mode (Compact Bar) */
#ai-chat-panel.mode-minimized {
    bottom: 2rem;
    right: 2rem;
    width: 320px;
    height: 70px;
    /* Only header visible */
    border-radius: 1rem;
    cursor: pointer;
}

#ai-chat-panel.mode-minimized .chat-body,
#ai-chat-panel.mode-minimized .chat-footer {
    opacity: 0;
    pointer-events: none;
    display: none;
    /* Hide content to prevent overflow issues */
}

/* 3. Fullscreen Mode (Immersive) */
#ai-chat-panel.mode-fullscreen {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Launcher Widget Styling */
#ai-chat-launcher {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto !important;
    /* Force clickability */
    z-index: 9999;
}

#ai-chat-launcher.hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    #ai-chat-panel.mode-default {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    #ai-chat-launcher {
        bottom: 2rem;
        right: 1.5rem;
    }
}

/* Message Bubbles */
.chat-message {
    animation: fadeIn 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

/* Typing Indicator Animation */
.typing-dot {
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes typingBounce {

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

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

/* Custom Scrollbar */
.chat-scroll::-webkit-scrollbar {
    width: 6px;
}

.chat-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.chat-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.chat-scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Header Gradient Text */
.ai-header-text {
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}