/* ═══════════════════════════════════════════════════════════
   GEMINI AI CHATBOT - MESSENGER STYLE
   ═══════════════════════════════════════════════════════════ */

/* Reset & Base */
.chatbot-hidden {
    display: none !important;
}

/* Floating Button */
.chatbot-floating-btn {
    position: fixed;
    bottom: 44px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.36) 0%, rgba(124, 58, 237, 0.36) 100%);
    border: 1.5px solid rgba(139, 92, 246, 0.55);
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-floating-btn:hover,
.chatbot-floating-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.6);
}

.chatbot-floating-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.8);
}

.chatbot-btn-icon {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

/* Badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-pulse {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: chatbot-pulse-animation 2s infinite;
}

@keyframes chatbot-pulse-animation {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0);
    }
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 480px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    z-index: 999;
    display: flex;
    flex-direction: column;
    animation: chatbot-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 110px);
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.chatbot-header {
    padding: 16px;
    background: var(--brand-grad, linear-gradient(135deg, #6D5AE6, #5B47D4));
    color: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: chatbot-pulse-animation 2s infinite;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message */
.chatbot-message {
    display: flex;
    gap: 8px;
    animation: chatbot-fade-in 0.3s ease-out;
}

@keyframes chatbot-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.chatbot-message-avatar {
    width: 28px;
    height: 28px;
    background: var(--brand-grad, linear-gradient(135deg, #6D5AE6, #5B47D4));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-message-user .chatbot-message-avatar {
    background: var(--brand-grad, linear-gradient(135deg, #6D5AE6, #5B47D4));
    color: white; 
}

.chatbot-message-content {
    max-width: 70%;
}

.chatbot-message-bubble {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: #1e293b;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-message-bubble {
    background: var(--brand-grad, linear-gradient(135deg, #6D5AE6, #5B47D4));
    color: white;
    border: none;
}

.chatbot-message-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
}

.chatbot-message-bubble pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 24px;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: chatbot-typing-animation 1.4s infinite;
}

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

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

@keyframes chatbot-typing-animation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Image Preview */
.chatbot-image-preview {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.chatbot-image-preview::-webkit-scrollbar {
    height: 4px;
}

.chatbot-image-preview::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.chatbot-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid #2563eb;
}

.chatbot-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-preview-remove {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.chatbot-preview-item:hover .chatbot-preview-remove {
    opacity: 1;
}

/* Input Area */
.chatbot-input-area {
    padding: 12px 16px;
    background: rgba(238, 238, 243, 0.849);
    border-top: 1px solid #e2e8f0;
}

/* Quick Actions */
.chatbot-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.chatbot-quick-actions::-webkit-scrollbar {
    height: 4px;
}

.chatbot-quick-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-quick-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.chatbot-quick-btn i {
    font-size: 11px;
}

/* Input Box */
.chatbot-input-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border-radius: 24px;
    padding: 8px 12px;
    transition: all 0.2s;
}

.chatbot-input-box:focus-within {
    background: white;
    box-shadow: 0 0 0 2px #4A9EE0;
    border: 1px solid #4A9EE0;
    padding: 8px 12px;
}

.chatbot-attach-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.chatbot-attach-btn:hover {
    color: #2563eb;
}

.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send-btn {
    width: 32px;
    height: 32px;
    background: var(--brand-grad, linear-gradient(135deg, #6D5AE6, #5B47D4));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.chatbot-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100% - 32px);
        height: calc(100vh - 120px);
        bottom: 96px;
        right: 16px;
        left: 16px;
    }

    .chatbot-message-content {
        max-width: 85%;
    }
}

/* Dark Mode Support - Class-based (.dark) */
body.dark .chatbot-window {
    background: #3f7bbf;
}

body.dark .chatbot-messages {
    background: #334155;
}

body.dark .chatbot-header {
    background: linear-gradient(135deg, #7DD3FC, #F87171);
}

body.dark .chatbot-message-avatar {
    background: linear-gradient(135deg, #7DD3FC, #F87171);
}

body.dark .chatbot-message-user .chatbot-message-avatar {
    background: linear-gradient(135deg, #7DD3FC, #F87171);
}

body.dark .chatbot-message-user .chatbot-message-bubble {
    background: linear-gradient(135deg, #7DD3FC, #F87171);
    color: white;
    border: none;
}

body.dark .chatbot-message-bubble {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark .chatbot-send-btn {
    background: linear-gradient(135deg, #7DD3FC, #F87171);
}

body.dark .chatbot-input-box {
    background: #334155;
}

body.dark .chatbot-input-box:focus-within {
    background: #334155;
    box-shadow: 0 0 0 2px #4A9EE0;
    border: 1px solid #4A9EE0;
}

body.dark .chatbot-input {
    color: #f1f5f9;
}

body.dark .chatbot-input::placeholder {
    color: #64748b;
}

body.dark .chatbot-quick-btn {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

body.dark .chatbot-quick-btn:hover {
    background: #7DD3FC;
    color: #1e293b;
    border-color: #7DD3FC;
}

