/* --- General Styles & Resets --- */
:root {
    --brand-color-light: #3b82f6;
    --brand-color-dark: #1d4ed8;
    --gray-light: #f9fafb;
    --gray-text: #374151;
}

.chatbot-component, .chatbot-component * {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

/* --- Body Scroll Lock --- */
body.chatbot-open {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
    touch-action: none;
}

/* --- Chatbot Toggle Button --- */
#chatbot-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    background-color: var(--brand-color-light);
    color: white;
    border: none;
    border-radius: 9999px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

#chatbot-toggle:hover {
    background-color: var(--brand-color-dark);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

#chatbot-toggle i {
    font-size: 1.5rem;
}

/* --- Main Chatbot Containers --- */
#chatbot-container, #mobile-chatbot {
    background-color: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#chatbot-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 24rem;
    height: 500px;
    max-height: 90vh;
    border-radius: 0.5rem;
    display: none; /* JS toggles this */
}

#mobile-chatbot {
    position: fixed;
    inset: 0;
    display: none; /* JS toggles this */
}

/* --- Header --- */
.chatbot-header {
    background: linear-gradient(to right, var(--brand-color-light), var(--brand-color-dark));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

#mobile-chatbot .chatbot-header {
    border-radius: 0;
}

.header-info {
    display: flex;
    align-items: center;
}

.header-icon {
    width: 2.5rem;
    height: 2.5rem;
    background-color: white;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    color: var(--brand-color-light);
}

.chatbot-header h3 {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.chatbot-header p {
    font-size: 0.75rem;
    color: #a5b4fc;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

/* --- Messages Area --- */
.chatbox {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--gray-light);
}

.chat {
    display: flex;
    margin-bottom: 0.75rem;
}

.chat-content {
    padding: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    max-width: 80%;
    word-wrap: break-word;
}

.chat-content p {
    margin: 0;
    font-size: 0.875rem;
}

.chat-incoming .chat-content {
    background-color: white;
    color: var(--gray-text);
}

.chat-outgoing {
    justify-content: flex-end;
}

.chat-outgoing .chat-content {
    background-color: var(--brand-color-light);
    color: white;
}

/* --- Input Area --- */
.chat-input {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background-color: white;
}

#chatbot-container .chat-input {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.input-form {
    display: flex;
    gap: 0.5rem;
}

.input-form textarea {
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

#chatbot-container textarea {
    min-height: 38px;
    max-height: 80px;
}

#mobile-chatbot textarea {
    min-height: 48px;
    max-height: 120px;
}

.input-form textarea:focus {
    outline: none;
    border-color: var(--brand-color-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.send-btn {
    background-color: var(--brand-color-light);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}