/* =========================================
   Chatbot Drop-In Component CSS
   ========================================= */

#qwj-chatbot {
    position: fixed;
    z-index: 9999;
    background: var(--white);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(15, 30, 46, 0.15);
    border: 1px solid var(--border);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    font-family: var(--font-main), sans-serif;
}

/* Desktop Placement */
@media (min-width: 769px) {
    #qwj-chatbot {
        bottom: 20px;
        right: 20px;
        width: 350px;
        height: 500px;
        border-radius: var(--radius);
        transform: translateY(150%);
        opacity: 0;
    }

    #qwj-chatbot.is-visible {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Placement (Drawer Style) */
@media (max-width: 768px) {
    #qwj-chatbot {
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65vh; /* Take up 65% of screen */
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        opacity: 1;
    }

    #qwj-chatbot.is-visible {
        transform: translateY(0);
    }
}

/* Header */
.qwj-chat-header {
    background: var(--primary);
    color: var(--white);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius) var(--radius) 0 0;
}

@media (max-width: 768px) {
    .qwj-chat-header {
        border-radius: 20px 20px 0 0;
    }
}

.qwj-chat-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qwj-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    background: var(--white);
    object-fit: contain;
}

.qwj-chat-info {
    display: flex;
    flex-direction: column;
}

.qwj-chat-name {
    font-family: var(--font-heading), sans-serif;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.1;
}

.qwj-chat-status {
    font-size: 0.75rem;
    color: #a0aab5;
}

.qwj-chat-close-btn {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.qwj-chat-close-btn:hover {
    opacity: 1;
}

/* Body & Messages */
.qwj-chat-body {
    flex-grow: 1;
    overflow-y: auto;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Prevents flush messages */
    padding: 15px 15px 20px;
    scroll-behavior: smooth;
}

.qwj-msg-bot {
    align-self: flex-start;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 15px 15px 15px 0;
    font-size: 0.95rem;
    color: var(--text-main);
    max-width: 85%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    animation: fade-in-up 0.3s ease;
}

.qwj-msg-user {
    align-self: flex-end;
    background: var(--secondary);
    color: var(--white);
    padding: 12px 16px;
    border-radius: 15px 15px 0 15px;
    font-size: 0.95rem;
    max-width: 85%;
    animation: fade-in-up 0.3s ease;
}

/* Inputs & Actions */
.qwj-chat-input-area {
    padding: 15px;
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* --- Dropdown UI --- */
.qwj-chat-select-wrapper {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
}

.qwj-chat-select {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-main), sans-serif;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--bg-main);
    cursor: pointer;
    transition: border-color 0.2s;
    /* Prevents flex squishing on small mobile displays */
    min-width: 0;
}

.qwj-chat-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--white);
}

.qwj-chat-send-btn {
    background: var(--secondary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-family: var(--font-heading), sans-serif;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.qwj-chat-send-btn:hover {
    background: var(--primary);
}

.qwj-chat-action-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--accent);
    color: var(--white) !important;
    font-family: var(--font-heading), sans-serif;
    font-weight: 700;
    padding: 12px;
    border-radius: var(--radius);
    text-decoration: none;
    margin-top: 10px;
    transition: background 0.2s;
}

.qwj-chat-action-btn:hover {
    background: var(--accent-hover);
}

.qwj-chat-action-btn.secondary {
    background: var(--primary);
}

.qwj-chat-action-btn.secondary:hover {
    background: var(--primary-light);
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}