/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
}

/* Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2c5f5f, #1a4a4a);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    outline: none;
}

.chatbot-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.chatbot-toggle i {
    color: white;
    font-size: 24px;
    transition: opacity 0.3s ease;
}

.chatbot-toggle .fa-times {
    display: none;
}

.chatbot-toggle.active .fa-comments {
    display: none;
}

.chatbot-toggle.active .fa-times {
    display: block;
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-window.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #2c5f5f, #1a4a4a);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #2c5f5f;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chatbot-info h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chatbot-info span {
    font-size: 0.8rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.3s ease;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user {
    align-self: flex-end;
    background: #2c5f5f;
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 5px rgba(44, 95, 95, 0.2);
}

.bot-typing {
    display: flex;
    gap: 5px;
    padding: 15px;
    background: white;
    width: fit-content;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
}

.bot-typing span {
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    animation: typing 1s infinite alternate;
}

.bot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.bot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    from {
        opacity: 0.4;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Quick Options */
.quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-option-btn {
    background: white;
    border: 1px solid #e0e0e0;
    color: #2c5f5f;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-option-btn:hover {
    background: #2c5f5f;
    color: white;
    border-color: #2c5f5f;
    transform: translateY(-2px);
}

/* Input Area */
.chatbot-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.chatbot-input input:focus {
    border-color: #2c5f5f;
}

.chatbot-send {
    background: none;
    border: none;
    color: #2c5f5f;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.chatbot-send:hover {
    transform: scale(1.1);
    color: #1a4a4a;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-window {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100dvh;
        border-radius: 0 !important;
        z-index: 99999;
        transform: translateY(110%);
        opacity: 0;
        transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    }

    .chatbot-window.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .chatbot-container {
        z-index: 99998;
        /* Ensure container is above other elements */
    }

    .chatbot-container.active {
        z-index: 99999;
    }

    /* Hide toggle button when chat is open on mobile */
    .chatbot-container.active .chatbot-toggle {
        opacity: 0;
        pointer-events: none;
        transform: scale(0);
        transition: all 0.3s ease;
    }

    .chatbot-toggle {
        z-index: 99999;
    }

    .chatbot-header {
        padding-top: max(20px, env(safe-area-inset-top));
        /* Safe area for notched phones */
    }
}