/* Chatbot Widget Styles */
:root {
    --chat-primary: #f97316;
    /* CodeAlves Brand Color */
    --chat-bg: #1a1a1a;
    --chat-header-bg: #222;
    --chat-text: #f6f4f0;
    --chat-user-bg: #f97316;
    --chat-bot-bg: #333;
}

/* Floating Action Button (FAB) */
#chatbot-fab {
    position: fixed;
    bottom: 110px;
    /* Adjusted to be well above WhatsApp button (~90px top) */
    right: 1.5rem;
    /* Matches Tailwind 'right-6' (24px) of WhatsApp button */
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9998;
    /* Below Cookie Banner (9999) */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chatbot-fab:hover {
    transform: scale(1.1);
}

#chatbot-fab svg {
    color: white;
    width: 30px;
    height: 30px;
}

/* Notification Dot */
.chat-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    display: block;
}

/* Main Chat Container - Hidden by default */
#chatbot-container {
    position: fixed;
    bottom: 170px;
    /* Adjusted for FAB at 100px */
    right: 20px;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background-color: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    /* Prevent clicks when hidden */
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid #333;
}

#chatbot-container.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.chat-header {
    padding: 16px;
    background-color: var(--chat-header-bg);
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.chat-title h3 {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.chat-status {
    font-size: 12px;
    color: #10b981;
    /* Green */
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 4px;
}

.chat-close-btn:hover {
    color: white;
}

/* Content Area */
#chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #1a1a1a;
}

/* Messages */
.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background-color: var(--chat-bot-bg);
    color: #e5e5e5;
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border-bottom-right-radius: 2px;
}

/* Input Area */
.chat-input-wrapper {
    padding: 12px;
    background-color: var(--chat-header-bg);
    border-top: 1px solid #333;
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    background-color: #333;
    border: 1px solid #444;
    padding: 10px 16px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    outline: none;
}

#chat-input:focus {
    border-color: var(--chat-primary);
}

#chat-send-btn {
    background: var(--chat-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

#chat-send-btn:hover {
    transform: scale(1.05);
}

/* Typing Indicator */
.typing {
    align-self: flex-start;
    background-color: var(--chat-bot-bg);
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    display: flex;
    gap: 4px;
    width: fit-content;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #aaa;
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        /* Full screen */
        max-height: 100%;
        border-radius: 0;
    }

    #chatbot-fab {
        bottom: 110px;
        right: 1.5rem;
    }
}