/* --- Floating Trigger Button --- */
#eac-toggle-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    border-radius: 50% !important;
    background-color: #0073aa;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 999999;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden;
    transition: transform 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

#eac-toggle-btn:hover {
    transform: scale(1.08);
    background-color: #005177;
}

/* Base SVG icon properties */
#eac-toggle-btn svg,
#eac-send-btn svg {
    max-width: 100% !important;
    max-height: 100% !important;
    fill: #ffffff !important;
    stroke: none !important;
    box-sizing: border-box;
}

/* Strictly control open/close icon display states */
#eac-toggle-btn #eac-icon-open {
    display: block !important;
}

#eac-toggle-btn #eac-icon-close {
    display: none !important;
}

/* Active state (when chatbox is open) */
#eac-toggle-btn.eac-active #eac-icon-open {
    display: none !important;
}

#eac-toggle-btn.eac-active #eac-icon-close {
    display: block !important;
}

/* --- Floating Chat Box --- */
#eac-chat-box {
    position: fixed !important;
    bottom: 95px;
    right: 25px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483646 !important; /* One layer below the button */
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#eac-chat-box.eac-closed {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* --- Header --- */
.eac-chat-header {
    background: #0073aa;
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.eac-header-avatar {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eac-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
}

.eac-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.eac-status-dot {
    width: 8px;
    height: 8px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

/* --- Messages Container --- */
#eac-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f8f9fa;
}

.eac-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.eac-msg-user {
    align-self: flex-end;
    background-color: #0073aa;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.eac-msg-bot {
    align-self: flex-start;
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 2px;
}

.eac-msg-loading {
    font-style: italic;
    color: #6c757d;
}

/* --- Input Area --- */
.eac-input-area {
    display: flex;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    gap: 8px;
    align-items: center;
}

#eac-user-input {
    flex-grow: 1;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#eac-user-input:focus {
    border-color: #0073aa;
}

#eac-send-btn {
    background-color: #0073aa;
    border: none;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

#eac-send-btn:hover {
    background-color: #005177;
}


.eac-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap !important; /* Preserves newlines and line breaks */
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    #eac-chat-box {
        right: 15px;
        left: 15px;
        width: auto;
        bottom: 85px;
        height: 70vh;
    }
}