/**
 * AI Chatbot Widget Styles
 * Lightweight AI-powered assistant for ITER EduHub
 */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 150px);
    background: var(--glass-bg, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
}

.chatbot-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    /* Perfect centering for the icon */
    padding: 0;
    line-height: 1;
    text-align: center;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.chatbot-toggle-icon {
    font-size: 1.8rem;
    transition: transform 0.3s ease;
    line-height: 1;
}

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

/* Chatbot Header */
.chatbot-header {
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5));
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.chatbot-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chatbot-status {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

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

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

/* Message Bubble */
.chat-message {
    max-width: 85%;
    padding: 0.875rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: fadeInUp 0.3s ease;
}

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

.chat-message.bot {
    background: var(--glass-bg, #f3f4f6);
    color: var(--text-primary, #1f2937);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chat-message.user {
    background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5));
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 1rem;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary, #9ca3af);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Quick Actions */
.chatbot-quick-actions {
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--glass-border, rgba(0, 0, 0, 0.1));
}

.quick-action-btn {
    padding: 0.5rem 0.875rem;
    background: var(--glass-bg, #f3f4f6);
    border: 1px solid var(--glass-border, rgba(0, 0, 0, 0.1));
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-primary, #1f2937);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: var(--primary, #6366f1);
    color: white;
    border-color: var(--primary, #6366f1);
}

/* Input Area */
.chatbot-input-area {
    padding: 1rem;
    border-top: 1px solid var(--glass-border, rgba(0, 0, 0, 0.1));
    display: flex;
    gap: 0.5rem;
}

.chatbot-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--glass-bg, #f3f4f6);
    border: 2px solid var(--glass-border, rgba(0, 0, 0, 0.1));
    border-radius: 25px;
    font-size: 0.9rem;
    color: var(--text-primary, #1f2937);
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    border-color: var(--primary, #6366f1);
}

.chatbot-input::placeholder {
    color: var(--text-secondary, #9ca3af);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary, #6366f1), var(--primary-dark, #4f46e5));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.chatbot-send:hover {
    transform: scale(1.05);
}

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

/* Dark Theme */
[data-theme="dark"] .chatbot-container {
    background: rgba(17, 24, 39, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .chat-message.bot {
    background: rgba(55, 65, 81, 0.8);
    color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .chatbot-input {
    background: rgba(55, 65, 81, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .quick-action-btn {
    background: rgba(55, 65, 81, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* Mobile Responsive - Full Screen Chatbot on Phones */
@media (max-width: 480px) {
    .chatbot-container {
        /* Compact size on mobile - covers less area so user can still use website */
        position: fixed;
        bottom: 80px;
        right: 10px;
        left: auto;
        top: auto;
        width: calc(100vw - 20px);
        height: 60vh;
        max-width: 100%;
        max-height: 60vh;
        border-radius: 16px;
        margin: 0;
        z-index: 9998;
    }

    .chatbot-toggle {
        right: 15px;
        bottom: 15px;
        width: 55px;
        height: 55px;
    }

    .chatbot-toggle-icon {
        font-size: 1.6rem;
    }

    .chatbot-header {
        padding: 1rem;
        border-radius: 16px 16px 0 0;
    }

    .chatbot-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .chatbot-messages {
        padding: 0.75rem;
    }

    .chatbot-quick-actions {
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
    }

    .quick-action-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .chatbot-input-area {
        padding: 0.75rem;
    }

    .chatbot-input {
        padding: 0.65rem 0.875rem;
        font-size: 0.875rem;
    }

    .chatbot-send {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .chat-message {
        max-width: 90%;
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
    }
}

/* Small phones (320px - 375px) */
@media (max-width: 375px) {
    .chatbot-toggle {
        right: 10px;
        bottom: 10px;
        width: 50px;
        height: 50px;
    }

    .chatbot-toggle-icon {
        font-size: 1.4rem;
    }

    .chatbot-title {
        font-size: 0.9rem;
    }

    .chatbot-status {
        font-size: 0.7rem;
    }

    .chatbot-avatar {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
}

/* Tablet responsive (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .chatbot-container {
        width: 380px;
        right: 20px;
        bottom: 90px;
        height: 500px;
        max-height: calc(100vh - 120px);
    }

    .chatbot-toggle {
        right: 20px;
        bottom: 20px;
        width: 58px;
        height: 58px;
    }
}

/* Navigation Helper Styles */
.nav-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    margin: 0.25rem 0;
    color: var(--primary, #6366f1);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-suggestion:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* FAQ Categories */
.faq-category {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.faq-item {
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-item:hover {
    background: rgba(99, 102, 241, 0.2);
}
