/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--shadow-medium);
    transition: all 0.3s ease;
    border: none;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px var(--shadow-heavy);
}

.chatbot-toggle.active {
    background: #dc3545;
}

.chatbot-icon {
    font-size: 24px;
    color: var(--bg-primary);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--bg-primary);
    border-radius: 15px;
    box-shadow: 0 10px 40px var(--shadow-heavy);
    border: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

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

.chatbot-header {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar {
    font-size: 20px;
}

.chatbot-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* API Status Indicators */
.chatbot-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    transition: color 0.3s ease;
}

.chatbot-status.success {
    color: #28a745;
}

.chatbot-status.error {
    color: #dc3545;
}

.chatbot-status.warning {
    color: #ffc107;
}

.chatbot-status.info {
    color: #17a2b8;
}

.status-indicator {
    font-size: 8px;
    margin-left: 4px;
}

/* Enhanced fallback message styling */
.chatbot-message.bot .message-content {
    line-height: 1.6;
}

.chatbot-message.bot .message-content b {
    color: var(--primary-color);
    font-weight: 600;
}

.chatbot-message.bot .message-content br {
    margin-bottom: 8px;
}

/* Quota exceeded notification */
.quota-notice {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 12px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--bg-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

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

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

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

.chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.chatbot-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chatbot-message.bot {
    align-self: flex-start;
    align-items: flex-start;
}

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

.chatbot-message.user .message-content {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-bottom-right-radius: 6px;
}

.chatbot-message.bot .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-color);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 8px;
}

.chatbot-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
}

#chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

#chatbot-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--shadow-light);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.chatbot-send-btn:hover {
    background: var(--accent-secondary);
    transform: scale(1.05);
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
    }
    
    .chatbot-icon {
        font-size: 22px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: 450px;
        bottom: 75px;
        right: -15px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .chatbot-input-container {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        height: 400px;
    }
    
    .message-content {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    #chatbot-input {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* Animation for typing indicator */
@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

/* Download button styles */
.chatbot-download-btn {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 10px 0;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.chatbot-download-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.chatbot-download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Course catalog download section */
.course-download-section {
    background: rgba(0, 123, 255, 0.1);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.course-download-section h4 {
    margin: 0 0 10px 0;
    color: var(--accent-primary);
    font-size: 16px;
}

.course-download-section ul {
    margin: 5px 0;
    padding-left: 20px;
}

.course-download-section li {
    margin: 5px 0;
    color: var(--text-primary);
}