/* ========== CHATBOT VARIABLES ========== */
:root {
    --accent: #e91e63;
    --dark: #1a202c;
    --light: #f8fafc;
    --gray: #718096;
    --orange: #FFA500;
    --orange-dark: #e69500;
    --orange-light: #FFF5F0;
    --medical-blue: #2A7DE1;
    --medical-teal: #00A896;

    /* ========== CHATBOT THEME - ORANGE ========== */
    --chatbot-accent: var(--orange);
    --chatbot-muted: #6b7280;
    --chatbot-bg: #ffffff;
    --bubble-user: var(--orange);
    --bubble-assistant: #f8fafc;
    --chatbot-border: #e5e7eb;
    --chatbot-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);

    /* ========== CSS VARIABLES ========== */
    --chatbot-width: 370px;
    --chatbot-height: 70vh;
    --chatbot-max-height: 700px;
    --chatbot-min-height: 500px;
    --response-min-height: 120px;
    --response-max-width: 85%;
    --response-padding: 16px;
    --btn-font-size: 12px;
    --btn-padding: 6px 12px;
    --btn-border-radius: 4px;
    --input-height: 45px;
    --input-font-size: 14px;
    --user-bubble-color: var(--orange);
    --bot-bubble-color: #f8fafc;
    --bubble-border-radius: 12px;
}

/* ========== CHATBOT STYLES ========== */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

.chatbot-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: var(--orange);
    color: white;
    border: none;
    box-shadow: var(--chatbot-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all 0.3s;
}

.chatbot-button:hover {
    background-color: var(--orange-dark);
    transform: scale(1.1);
}

/* Chatbot Window */
.chatbot-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: var(--chatbot-width);
    height: var(--chatbot-height);
    max-height: var(--chatbot-max-height);
    min-height: var(--chatbot-min-height);
    background-color: white;
    border-radius: 12px;
    box-shadow: var(--chatbot-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chatbot-border);
}

.chatbot-header {
    background-color: var(--chatbot-accent);
    color: white;
    padding: 18px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.close-chatbot {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-chatbot:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Chat Messages Area */
.chatbot-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
}

/* Message Bubbles */
.message {
    max-width: var(--response-max-width);
    padding: var(--response-padding);
    border-radius: var(--bubble-border-radius);
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bot-message {
    background-color: var(--bot-bubble-color);
    border: 1px solid var(--chatbot-border);
    align-self: flex-start;
    margin-right: auto;
    border-top-left-radius: 4px;
}

.user-message {
    background-color: var(--user-bubble-color);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-top-right-radius: 4px;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    align-items: center;
    flex-wrap: wrap;
}

.message-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--chatbot-muted);
    font-size: var(--btn-font-size);
    padding: 4px 8px;
    border-radius: var(--btn-border-radius);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.message-action-btn i {
    font-size: 14px;
}

.message-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--chatbot-accent);
}

/* Special buttons */
.sources-btn,
.elaborate-btn {
    background: transparent;
    color: var(--chatbot-muted);
    border: 1px solid var(--chatbot-border);
    font-weight: 500;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    margin-left: 4px;
}

.sources-btn:hover,
.elaborate-btn:hover {
    background-color: #f8f9fa;
    color: var(--chatbot-accent);
    border-color: var(--chatbot-accent);
}

/* ========== UPDATED: Contact Form - WIDER & NO SCROLL ========== */
.contact-form-container {
    background: white;
    border: 1px solid var(--chatbot-border);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 400px;
    /* Made wider */
    position: relative;
}

.contact-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    /* Increased padding */
    border-bottom: 1px solid var(--chatbot-border);
    background-color: #f9fafb;
    position: relative;
}

.contact-form-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    flex: 1;
}

.contact-form-close {
    background: none;
    border: none;
    color: var(--chatbot-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: background-color 0.2s;
}

.contact-form-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--dark);
}

.contact-form-content {
    padding: 20px;
    /* REMOVED max-height and overflow-y to eliminate scrolling */
}

.form-group {
    margin-bottom: 20px;
    /* Increased spacing */
}

.form-label {
    display: block;
    font-size: 13px;
    color: var(--chatbot-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 15px;
    /* Increased padding */
    border: 1px solid var(--chatbot-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    color: var(--dark);
    background-color: white;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.1);
}

.form-textarea {
    min-height: 100px;
    /* Fixed height */
    resize: none;
    /* Disable resize */
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--chatbot-border);
}

.form-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--chatbot-border);
    background: white;
    transition: all 0.2s;
}

.form-cancel {
    color: var(--chatbot-muted);
}

.form-cancel:hover {
    background-color: #f3f4f6;
}

.form-submit {
    background: var(--chatbot-accent);
    color: white;
    border-color: var(--chatbot-accent);
}

.form-submit:hover {
    background-color: var(--orange-dark);
    border-color: var(--orange-dark);
}

/* ========== UPDATED: Sources Modal with Toggle ========== */
.sources-modal {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--chatbot-border);
    width: 320px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    font-size: 13px;
    display: none;
    /* Hidden by default */
}

.sources-modal.active {
    display: block;
    /* Show when active */
}

.sources-modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--chatbot-border);
    font-weight: 600;
    color: var(--dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9fafb;
}

.sources-modal-content {
    padding: 0;
}

/* Brochure Item */
.brochure-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f1f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.brochure-item:hover {
    background-color: #f9fafb;
}

.brochure-item:last-child {
    border-bottom: none;
}

.brochure-info {
    flex-grow: 1;
}

.brochure-name {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 4px;
    font-size: 13px;
}

.brochure-meta {
    font-size: 11px;
    color: var(--chatbot-muted);
}

.download-brochure-btn {
    background: var(--chatbot-accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.download-brochure-btn:hover {
    background-color: var(--orange-dark);
}

/* Upload Dropdown */
.upload-menu {
    position: relative;
}

.upload-toggle {
    background: none;
    border: none;
    color: var(--chatbot-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.upload-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--chatbot-accent);
}

.upload-dropdown {
    position: absolute;
    bottom: 45px;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 200px;
    display: none;
    z-index: 10;
    border: 1px solid var(--chatbot-border);
    overflow: hidden;
}

.upload-dropdown.show {
    display: block;
}

.upload-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: var(--dark);
    transition: background-color 0.2s;
    font-size: 13px;
    border-bottom: 1px solid #f1f1f1;
}

.upload-option:last-child {
    border-bottom: none;
}

.upload-option:hover {
    background-color: #f9fafb;
    color: var(--chatbot-accent);
}

.upload-option i {
    color: var(--chatbot-accent);
    width: 16px;
    font-size: 14px;
}

/* Chat Input Area */
.chatbot-input-area {
    border-top: 1px solid var(--chatbot-border);
    background-color: white;
    padding: 16px;
}

.chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f9fafb;
    border-radius: 24px;
    padding: 8px 16px;
    border: 1px solid var(--chatbot-border);
    transition: border-color 0.2s;
}

.chatbot-input-container:focus-within {
    border-color: var(--chatbot-accent);
    background-color: white;
}

.chatbot-input {
    flex-grow: 1;
    border: none;
    padding: 10px 0;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: #374151;
    font-family: 'Poppins', sans-serif;
}

.chatbot-input::placeholder {
    color: var(--chatbot-muted);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-action-btn {
    background: none;
    border: none;
    color: var(--chatbot-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.input-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--chatbot-accent);
}

/* Send button */
.send-btn {
    background-color: var(--chatbot-accent);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(255, 165, 0, 0.2);
}

.send-btn:hover {
    background-color: var(--orange-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(255, 165, 0, 0.3);
}

/* Contact Owner Button */
.contact-owner-btn {
    background: transparent;
    color: var(--chatbot-accent);
    border: 1px solid var(--chatbot-accent);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    font-weight: 500;
}

.contact-owner-btn:hover {
    background-color: rgba(255, 165, 0, 0.1);
}

/* Uploaded Files */
.uploaded-files {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f3f4f6;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #374151;
}

.file-preview img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.remove-file {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
}

.remove-file:hover {
    color: #ef4444;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    .chatbot-button {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .chatbot-window {
        width: calc(100vw - 40px);
        right: 0;
        height: 70vh;
    }

    .contact-form-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .sources-modal {
        width: 280px;
        right: 10px;
    }
}

/* ========== UPDATED: Feedback Form Styles ========== */
.feedback-form-container {
    background: white;
    border: 1px solid var(--chatbot-border);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 380px;
}

.feedback-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--chatbot-border);
    background-color: #f9fafb;
}

.feedback-form-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    flex: 1;
}

.feedback-form-content {
    padding: 15px;
}

.feedback-form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--chatbot-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: var(--dark);
    background-color: white;
    transition: border-color 0.2s;
    resize: vertical;
    min-height: 80px;
    max-height: 120px;
}

.feedback-form-textarea:focus {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.1);
}

.feedback-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.feedback-form-btn {
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--chatbot-border);
    background: white;
    transition: all 0.2s;
}

.feedback-form-cancel {
    color: var(--chatbot-muted);
}

.feedback-form-cancel:hover {
    background-color: #f3f4f6;
}

.feedback-form-submit {
    background: var(--chatbot-accent);
    color: white;
    border-color: var(--chatbot-accent);
}

.feedback-form-submit:hover {
    background-color: var(--orange-dark);
    border-color: var(--orange-dark);
}

.feedback-thank-you {
    padding: 20px;
    text-align: center;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--chatbot-border);
}

.feedback-thank-you i {
    color: #10b981;
    font-size: 24px;
    margin-bottom: 10px;
}

.feedback-thank-you p {
    font-size: 13px;
    color: var(--dark);
    margin: 0;
}

/* ========== COMPACT Contact Form ========== */
.compact-contact-form {
    background: white;
    border: 1px solid var(--chatbot-border);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 380px;
}

.compact-contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--chatbot-border);
    background-color: #f9fafb;
}

.compact-contact-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    flex: 1;
}

.compact-contact-close {
    background: none;
    border: none;
    color: var(--chatbot-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    transition: background-color 0.2s;
}

.compact-contact-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--dark);
}

.compact-contact-content {
    padding: 15px;
}

.compact-form-group {
    margin-bottom: 12px;
}

.compact-form-label {
    display: block;
    font-size: 11px;
    color: var(--chatbot-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.compact-form-input,
.compact-form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--chatbot-border);
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    color: var(--dark);
    background-color: white;
    transition: border-color 0.2s;
}

.compact-form-input:focus,
.compact-form-textarea:focus {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.1);
}

.compact-form-textarea {
    min-height: 60px;
    max-height: 80px;
    resize: vertical;
}

.compact-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f1f1;
}

.compact-form-btn {
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--chatbot-border);
    background: white;
    transition: all 0.2s;
}

.compact-form-cancel {
    color: var(--chatbot-muted);
}

.compact-form-cancel:hover {
    background-color: #f3f4f6;
}

.compact-form-submit {
    background: var(--chatbot-accent);
    color: white;
    border-color: var(--chatbot-accent);
}

.compact-form-submit:hover {
    background-color: var(--orange-dark);
    border-color: var(--orange-dark);
}

.compact-contact-success {
    padding: 20px 15px;
    text-align: center;
    background: white;
    border-radius: 8px;
}

.compact-contact-success i {
    color: #10b981;
    font-size: 24px;
    margin-bottom: 10px;
}

.compact-contact-success h5 {
    font-size: 13px;
    color: var(--dark);
    margin: 0 0 5px 0;
    font-weight: 600;
}

.compact-contact-success p {
    font-size: 11px;
    color: var(--chatbot-muted);
    margin: 0;
}

/* Remove elaborate button from message actions */
.message-action-btn.elaborate-btn {
    display: none !important;
}

/* Adjust message actions for better spacing */
.message-actions {
    gap: 6px;
}

.sources-btn {
    margin-left: 0 !important;
    padding: 3px 8px !important;
}

/* Remove the old elaborate button from CSS */
.elaborate-btn {
    display: none;
}