/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Chat Bubble */
.chatbot-bubble {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50px;
    padding: 16px 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.3);
    transition: all 0.3s ease;
    position: relative;
    min-width: 200px;
}

.chatbot-bubble:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.4);
}

.chatbot-bubble.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.bubble-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.bubble-icon {
    font-size: 18px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-2px); }
}

.bubble-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px 16px 0 0;
    color: white;
}

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

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

.header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

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

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.minimize-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
    max-height: 300px;
}

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

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

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

/* Message Styles */
.message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-start;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

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

.message-text {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.bot .message-text {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.message.user .message-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    margin-left: auto;
}

.message-time {
    font-size: 11px;
    color: var(--text);
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

/* Typing Indicator */
.message.typing .message-text {
    padding: 16px;
    display: flex;
    align-items: center;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text);
    opacity: 0.4;
    animation: typing 1.4s infinite;
}

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

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

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


/* Input Container */
.chatbot-input-container {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    max-height: 80px;
}

.chatbot-input:focus {
    border-color: var(--primary);
}

.chatbot-input::placeholder {
    color: var(--text);
    opacity: 0.5;
}

.chatbot-send {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

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

.send-icon {
    font-size: 16px;
    transform: rotate(-45deg);
}

/* Footer */
.chatbot-footer {
    text-align: center;
    padding: 8px 20px;
    font-size: 11px;
    color: var(--text);
    opacity: 0.5;
    border-top: 1px solid var(--border);
}

/* Message Links */
.message-text a {
    color: var(--primary);
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.message.user .message-text a {
    color: rgba(255, 255, 255, 0.9);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        max-width: 360px;
        height: 480px;
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-bubble {
        min-width: 160px;
        padding: 12px 16px;
    }
    
    .bubble-content {
        font-size: 13px;
    }
    
    .bubble-icon {
        font-size: 16px;
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .chatbot-messages {
        max-height: 240px;
    }
    
}

@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        bottom: 8px;
        right: 8px;
        border-radius: 12px;
    }
    
    .chatbot-header {
        border-radius: 12px 12px 0 0;
    }
    
    .chatbot-messages {
        max-height: calc(100vh - 300px);
    }
}

/* Animation for message appearance */
.message {
    animation: slideInMessage 0.3s ease;
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility improvements */
.chatbot-send:focus,
.minimize-btn:focus,
.chatbot-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chatbot-window {
        border: 2px solid var(--text);
    }
    
    .message.bot .message-text {
        border: 2px solid var(--border);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .chatbot-bubble,
    .chatbot-window,
    .message,
    .chatbot-send {
        transition: none;
    }
    
    .bubble-icon,
    .typing-dots span,
    .status::before,
    .bubble-notification {
        animation: none;
    }
}