/* ========== Chatbot Widget Styles ========== */

:root {
    --chatbot-primary: #667eea;
    --chatbot-secondary: #764ba2;
    --chatbot-text: #333;
    --chatbot-light: #f8f9fa;
    --chatbot-border: #e0e0e0;
}

/* Chatbot Widget Container */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: 'Inter', sans-serif;
    z-index: 9999;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 420px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

.chat-window.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.status {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status i {
    color: #4ade80;
    font-size: 8px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Message Styles */
.message {
    display: flex;
    gap: 10px;
    animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.message-bubble {
    max-width: 280px;
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--chatbot-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .message-bubble {
    background: var(--chatbot-primary);
    color: white;
    border: none;
}

.message-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-text p {
    margin: 0 0 8px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text a {
    color: var(--chatbot-primary);
    text-decoration: none;
    font-weight: 500;
}

.user-message .message-text a {
    color: white;
}

.message-text strong {
    font-weight: 600;
    color: inherit;
}

/* Typing Indicator */
.typing-indicator-container {
    display: flex !important;
    gap: 10px !important;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 15px;
    background: white;
}

.quick-btn {
    padding: 8px 14px;
    background: var(--chatbot-light);
    border: 1px solid var(--chatbot-border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--chatbot-text);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.quick-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
}

/* Input Area */
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    border-radius: 0 0 16px 16px;
}

#chat-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    background: var(--chatbot-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--chatbot-secondary);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
    }

    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .message-bubble {
        max-width: 200px;
    }

    .quick-actions {
        padding: 0 15px 12px;
    }
}

/* Back to top button styles */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--chatbot-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
    text-decoration: none;
    font-size: 20px;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--chatbot-secondary);
    transform: translateY(-5px);
}
