/* =========================================
   GLEEMATIC CHATBOT - ORIGINAL STABLE
   ========================================= */

/* Use a safe z-index and reset box-sizing */
.lobe-chat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.lobe-chat-launcher * {
    box-sizing: border-box;
}

/* --- LAUNCHER BUTTON --- */
.lobe-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1677ff; /* Standard Blue */
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lobe-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* --- CHAT WIDGET WINDOW --- */
.lobe-chat-widget {
    display: none; /* Toggled by JS */
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    height: 600px;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border: 1px solid #f0f0f0;
    flex-direction: column;
    overflow: hidden;
}

.lobe-chat-widget.open {
    display: flex;
}

.lobe-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- HEADER --- */
.lobe-chat-header {
    height: 60px;
    padding: 0 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    flex-shrink: 0;
}

.lobe-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lobe-avatar-circle {
    width: 36px;
    height: 36px;
    background: #1677ff;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

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

.lobe-chat-status {
    font-size: 12px;
    color: #52c41a;
    display: block;
}

.lobe-chat-header-actions button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lobe-chat-header-actions button:hover {
    background: #f5f5f5;
}

/* --- SETTINGS PANEL --- */
.lobe-settings-panel {
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    padding: 10px;
}
.lobe-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.lobe-settings-header h4 { margin: 0; }
.lobe-settings-close { border: none; background: none; cursor: pointer; }

/* --- MESSAGES --- */
.lobe-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lobe-chat-welcome {
    text-align: center;
    margin-top: 50px;
    color: #999;
}

.lobe-message {
    display: flex;
    gap: 12px;
    max-width: 90%;
}
.lobe-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.lobe-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.lobe-message.user .lobe-message-avatar { background: #1677ff; color: #fff; }

.lobe-message-content {
    background: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    font-size: 14px;
    line-height: 1.5;
}
.lobe-message.user .lobe-message-content {
    background: #1677ff;
    color: #fff;
    border-color: #1677ff;
}

/* --- INPUT AREA --- */
.lobe-chat-input-container {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
}
.lobe-chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}
.lobe-chat-input-actions { display: flex; gap: 4px; }
.lobe-action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}
.lobe-chat-input-main { flex: 1; }
.lobe-chat-input {
    width: 100%;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 8px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    outline: none;
}
.lobe-chat-input-send { display: flex; align-items: flex-end; }
.lobe-send-btn {
    width: 32px;
    height: 32px;
    background: #1677ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

/* --- POPUP / MODAL (STABLE) --- */
.lobe-popup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lobe-popup-container {
    background: #fff;
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.lobe-popup-header {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lobe-popup-title { margin: 0; font-size: 18px; font-weight: 600; }
.lobe-popup-close {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
}
.lobe-popup-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.lobe-popup-footer {
    padding: 16px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}
.lobe-popup-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    background: #fff;
    cursor: pointer;
}
.lobe-popup-btn-primary {
    background: #1677ff;
    color: #fff;
    border-color: #1677ff;
}

/* Typing Indicator */
.lobe-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #f0f0f0;
    border-radius: 12px;
    width: fit-content;
}
.lobe-typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}
.lobe-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.lobe-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
