/* ============================================
   AI ASSISTANT CHATBOT - PREMIUM UI
   Glassmorphic design with stunning animations
   ============================================ */

/* Chatbot Toggle Button */
:root {
    --chatbot-ripple: 0, 255, 136; /* dark mode green */
}

[data-theme="light"] {
    --chatbot-ripple: 217, 119, 6; /* light mode amber */
}

:root {
    --chatbot-header-grad-1: 0, 255, 136;
    --chatbot-header-grad-2: 0, 212, 255;
}

[data-theme="light"] {
    --chatbot-header-grad-1: 217, 119, 6;
    --chatbot-header-grad-2: 234, 88, 12;
}

:root {
    --chatbot-accent: 0, 255, 136; /* dark mode green */
}

[data-theme="light"] {
    --chatbot-accent: 217, 119, 6; /* light mode amber */
}

:root[data-theme="dark"] {
    --chatbot-action: rgba(0, 255, 136, 0.25);   /* green */
    --chatbot-action-border: rgba(0, 255, 136, 0.6);
    --chatbot-action-solid: #00ff88;
}

:root[data-theme="light"] {
    --chatbot-action: rgba(217, 119, 6, 0.25);   /* orange */
    --chatbot-action-border: rgba(217, 119, 6, 0.6);
    --chatbot-action-solid: #d97706;
}
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 8px 32px rgba(var(--chatbot-ripple), 0.3),
        0 0 0 0 rgba(var(--chatbot-ripple), 0.4);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: pulse-ring 2s ease-out infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 
        0 12px 40px rgba(var(--chatbot-ripple), 0.5),
        0 0 60px rgba(var(--chatbot-ripple), 0.3);
}

.chatbot-toggle.active {
    animation: none;
    transform: rotate(180deg);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    color: var(--bg-primary);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chatbot-toggle .icon-chat { display: block; }
.chatbot-toggle .icon-close { display: none; position: absolute; }
.chatbot-toggle.active .icon-chat { display: none; }
.chatbot-toggle.active .icon-close { display: block; }

@keyframes pulse-ring {
    0% {
        box-shadow: 
            0 8px 32px rgba(var(--chatbot-ripple), 0.3),
            0 0 0 0 rgba(var(--chatbot-ripple), 0.4);
    }
    70% {
        box-shadow: 
            0 8px 32px rgba(var(--chatbot-ripple), 0.3),
            0 0 0 20px rgba(var(--chatbot-ripple), 0);
    }
    100% {
        box-shadow: 
            0 8px 32px rgba(var(--chatbot-ripple), 0.3),
            0 0 0 0 rgba(var(--chatbot-ripple), 0);
    }
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ff4757;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    border: 2px solid var(--bg-primary);
    animation: bounce-in 0.5s ease;
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 420px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
    padding: 20px 24px;
    background: linear-gradient(
        135deg,
        rgba(var(--chatbot-header-grad-1), 0.12) 0%,
        rgba(var(--chatbot-header-grad-2), 0.12) 100%
    );
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.1),
        transparent
    );
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none; /* ← THIS FIXES IT */
}


@keyframes shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

.chatbot-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #00ff88;
    border-radius: 50%;
    bottom: 0;
    right: 0;
    border: 3px solid var(--bg-secondary);
    animation: pulse-glow 2s ease-in-out infinite;
}

.chatbot-avatar svg {
    width: 26px;
    height: 26px;
    color: var(--bg-primary);
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chatbot-header-info p {
    font-size: 0.8rem;
    color: rgba(var(--chatbot-header-grad-1), 0.9);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-header-info p::before {
    content: '';
    width: 8px;
    height: 8px;
    background: rgb(var(--chatbot-header-grad-1));
    border-radius: 50%;
    animation: pulse-glow 2s ease-in-out infinite;
}

.chatbot-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
}

.chatbot-close:hover {
    background: var(--chatbot-action);
    border-color: var(--chatbot-action-border);
}

.chatbot-close svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 90%;
    animation: message-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.message.user {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.message.bot .message-avatar {
    background: var(--gradient-primary);
}

.message.bot .message-avatar svg {
    width: 18px;
    height: 18px;
    color: var(--bg-primary);
}

.message.user .message-avatar {
    background: var(--accent-tertiary);
    color: white;
    font-weight: 600;
}

.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 14px 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    position: relative;
}

.message.bot .message-content {
    border-radius: 18px 18px 18px 4px;
    background: var(--bg-card);
}

.message.user .message-content {
    border-radius: 18px 18px 4px 18px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 212, 255, 0.15) 100%);
    border-color: rgba(0, 255, 136, 0.3);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    max-width: 90%;
    animation: message-in 0.3s ease;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px 18px 18px 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

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

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Suggestions */
.message-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.suggestion-chip {
    padding: 8px 14px;
    background: rgba(var(--chatbot-accent), 0.1);
    border: 1px solid rgba(var(--chatbot-accent), 0.3);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--accent-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--chatbot-accent), 0.2);
}

/* Input Area */
.chatbot-input {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chatbot-input-wrapper {
    flex: 1;
    position: relative;
}

.chatbot-input textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.95rem;
    resize: none;
    min-height: 52px;
    max-height: 120px;
    transition: all var(--transition-base);
    line-height: 1.5;
}

.chatbot-input textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.chatbot-input textarea::placeholder {
    color: var(--text-muted);
}

.chatbot-send {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(var(--chatbot-accent), 0.4);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send svg {
    width: 22px;
    height: 22px;
    color: var(--bg-primary);
    transition: transform var(--transition-base);
}

.chatbot-send:hover:not(:disabled) svg {
    transform: translateX(2px);
}

/* Welcome Screen */
.chatbot-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-icon svg {
    width: 40px;
    height: 40px;
    color: var(--bg-primary);
}

.chatbot-welcome h4 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chatbot-welcome p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.welcome-suggestions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.welcome-suggestion {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.welcome-suggestion:hover {
    border-color: var(--accent-primary);
    background: rgba(var(--chatbot-accent), 0.05);
    transform: translateX(5px);
}

.welcome-suggestion-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.welcome-suggestion-icon svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

/* Powered By Footer */
.chatbot-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.chatbot-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
    }
    
    .chatbot-container.active {
        transform: translateY(0);
    }
}

/* Light mode adjustments */
[data-theme="light"] .chatbot-container {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

[data-theme="light"] .message.user .message-content {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.15) 0%, rgba(234, 88, 12, 0.15) 100%);
    border-color: rgba(217, 119, 6, 0.3);
}

[data-theme="light"] .suggestion-chip {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.3);
    color: var(--accent-primary);
}

/* Error state */
.message.error .message-content {
    background: rgba(255, 71, 87, 0.1);
    border-color: rgba(255, 71, 87, 0.3);
    color: #ff4757;
}

/* Link styling in messages */
.message-content a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message-content a:hover {
    text-decoration: none;
}

/* Code blocks in messages */
.message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

/* Emoji support */
.message-content .emoji {
    font-size: 1.2em;
}
