/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Launcher Button */
.chatbot-launcher {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    outline: none;
}

.chatbot-launcher:hover {
    transform: scale(1.1);
}

.chatbot-launcher svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

/* Header */
.chatbot-header {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: rgba(246, 248, 255, 0.5);
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message p {
    margin: 0 0 8px 0;
}

.message p:last-child {
    margin-bottom: 0;
}

.message.bot {
    align-self: flex-start;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 5px;
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 15px rgba(110, 142, 251, 0.25);
}

/* Input Area Refinement */
.chatbot-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 12px;
}

.chatbot-input-area input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.5);
}

.chatbot-input-area input:focus {
    border-color: #6e8efb;
    background: white;
}

.chatbot-send-btn {
    background: #6e8efb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbot-send-btn:hover {
    background: #5d7ce8;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: white;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: typing 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 typing {

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

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

@media (max-width: 480px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }

    .chatbot-launcher {
        width: 50px;
        height: 50px;
    }

    .chatbot-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
    }

    .chatbot-messages {
        height: auto;
        /* Flex grow handles it */
        flex: 1;
    }

    .chatbot-input-area {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}