/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

.chatbot-toggle {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    min-width: 180px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.chatbot-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.4);
}

.chatbot-toggle:hover::before {
    left: 100%;
}

.chatbot-toggle:active {
    transform: translateY(-1px);
}

.chat-text {
    font-size: 0.95rem;
    font-weight: 500;
}

#close-icon {
    display: none;
}

.chatbot-window {
    position: fixed;
    top: 0;
    right: -50vw;                    
    width: 50vw;                     
    height: 100vh;                   
    background: #fff;                
    border-radius: 20px 0 0 20px;    
    box-shadow: -6px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--border-color);
    z-index: 9999;
    transition: right 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
    opacity: 0;
}

.chatbot-window.active {
    right: 0;
    opacity: 1;
}


/* When active, bring it into view */
.chatbot-window.active {
    right: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.bot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.bot-avatar i {
    font-size: 1.3rem;
}

.bot-info h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.status {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat messages container */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* General message wrapper */
.message {
    display: flex;
    margin: 8px 0;
    width: 100%;            /* take full width so alignment works */
}

/* User messages aligned right */
.user-message {
    justify-content: flex-end;
    display: flex;
    width: 100%;
}

/* Bot messages aligned left */
.bot-message {
    justify-content: flex-start;
    display: flex;
    width: 100%;
}

.user-message {
    display: flex;
    justify-content: flex-end;   /* push user messages to the right */
    margin: 8px 0;
}

.user-message .message-content {
    background: var(--primary-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: 16px 16px 0 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 70%;              /* limit width so it doesn’t stretch */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: left;            /* keep text aligned inside bubble */
}

.bot-message {
    display: flex;
    justify-content: flex-start; /* push bot messages to the left */
    margin: 8px 0;
}

.bot-message .message-content {
    background: #f1f1f1;
    color: #333;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 0;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 70%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message .message-content {
    background: #f1f1f1;
    color: #333;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 0;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}


.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.message-content {
    flex: 1;
    max-width: 80%;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
    display: block;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #f1f1f1;
    border-radius: 16px 16px 16px 4px;
    max-width: fit-content;
    margin: 6px 0;
    animation: fadeIn 0.3s ease-in-out;
}

.typing-indicator .message-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #555;
    border-radius: 50%;
    opacity: 0.4;
    animation: blink 1.4s infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}
.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chatbot-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.login-required {
    text-align: center;
    padding: 15px;
    background: var(--background-light);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.login-required p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

.login-required a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.login-required a:hover {
    text-decoration: underline;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
    resize: none;
    min-height: 20px;
    max-height: 100px;
    line-height: 1.4;
}

#chat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#chat-input:disabled {
    background: var(--background-light);
    color: var(--text-secondary);
    cursor: not-allowed;
}

#send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

#send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

#send-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
    }
    
    .chatbot-toggle {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .chatbot-window {
        width: 100%;
        height: 500px;
        bottom: 60px;
        right: 0;
        left: 0;
        border-radius: 15px;
    }
    
    .chat-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .chatbot-window {
        right: -100vw;
        width: 100vw;
        height: 90vh;
        border-radius: 20px 20px 0 0;
        bottom: 0;
        top: auto;
    }

    .chatbot-window.active {
        right: 0;
        opacity: 1;
    }

    .chatbot-header {
        padding: 15px;
    }
    
    .bot-avatar {
        width: 40px;
        height: 40px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .chatbot-input-area {
        padding: 15px;
    }
    
    
}