/* Chatbot Container */
#chatbot-container {
    position: fixed;
    bottom: 6rem;
    /* Moved up to avoid overlap */
    right: 2rem;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

/* Tooltip Label */
#chatbot-container::before {
    content: "Chat with AI 🧠";
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    opacity: 1;
    /* Always visible to attract attention */
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

#chatbot-container:hover::before {
    transform: translateY(-50%) scale(1.05);
}

/* Pulse Animation */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* Floating Action Button */
#chatbot-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: pulse-glow 2s infinite;
    /* Add pulse */
}

#chatbot-toggle-btn::after {
    content: "🧠";
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
    animation: brainPulse 2s ease-in-out infinite;
}

#chatbot-toggle-btn:hover {
    transform: scale(1.1);
    animation: none;
    /* Stop pulse on hover */
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

#chatbot-toggle-btn:hover::after {
    animation: none;
    transform: scale(1.15);
}

.chatbot-icon {
    font-size: 30px;
    color: white;
    transition: transform 0.3s ease;
}

#chatbot-toggle-btn.open .chatbot-icon {
    transform: rotate(45deg);
}

/* Chat Window */
#chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(20, 20, 35, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

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

/* Header */
.chatbot-header {
    padding: 1rem;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bot-avatar {
    width: 35px;
    height: 35px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.bot-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.bot-status {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bot-status.learning-status {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

#learning-indicator {
    animation: fadeGlow 2s ease-in-out infinite;
}

@keyframes fadeGlow {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; text-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px #4ade80;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Messages Area */
#chatbot-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

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

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

#chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease;
}

.message a {
    color: #a855f7;
    text-decoration: underline;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 5px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.message.bot::before {
    content: "🧠";
    position: absolute;
    top: -8px;
    left: -8px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    animation: brainPulse 2s ease-in-out infinite;
}

@keyframes brainPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border-bottom-right-radius: 5px;
}

/* Suggestion Chips */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    animation: messageSlide 0.4s ease;
}

.suggestion-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    transform: translateY(-2px);
}

/* Action Button (Go to Section) */
.chatbot-action-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.chatbot-action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    align-self: flex-start;
    width: fit-content;
    margin-bottom: 0.5rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

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

#chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

#chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#chatbot-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
}

#chatbot-send-btn {
    background: transparent;
    border: none;
    color: #6366f1;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatbot-send-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.1);
}

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

/* Mobile Responsiveness */
@media screen and (max-width: 480px) {
    #chatbot-window {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 90px;
        height: 60vh;
    }
}