/* === Base — reset theme inheritance === */
#orbit-chatbox, #orbit-chatbox * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#orbit-chatbox {
    font-size: 15px;
    line-height: 1.5;
    color: #1e293b;
}

/* === Toggle Button === */
#orbit-chat-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.45);
    z-index: 99999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#orbit-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.6);
}

/* === Chatbox Container === */
#orbit-chatbox {
    position: fixed;
    right: 20px;
    bottom: 95px;
    width: 380px;
    height: 600px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    z-index: 99998;
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#orbit-chatbox.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* === Header === */
#orbit-header {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.orbit-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.orbit-header-text { flex: 1; }
.orbit-header-text .title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}
.orbit-header-text .subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
}
#orbit-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}
#orbit-close:hover { background: rgba(255, 255, 255, 0.28); }

/* === Messages Area === */
#orbit-messages {
    flex: 1 1 0;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 16px;
    background: #f8fafc;
    scroll-behavior: smooth;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}
#orbit-messages::-webkit-scrollbar { width: 4px; }
#orbit-messages::-webkit-scrollbar-track { background: transparent; }
#orbit-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* === Message Rows === */
.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 14px;
}
.message.user { flex-direction: row-reverse; }

/* === Bot Avatar in Messages === */
.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

/* === Bubble Wrappers === */
.bot-content { max-width: 82%; }

/* === Bubbles === */
.bubble {
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
}
.user .bubble {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
    max-width: 78%;
}
.bot .bubble {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

/* Hard reset — override ANY theme p/li/strong styles inside bubbles */
.bubble * {
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}
.bubble p  { margin-bottom: 6px !important; }
.bubble p:last-child { margin-bottom: 0 !important; }
.bubble ul { margin: 5px 0 !important; padding-left: 18px !important; list-style: disc !important; }
.bubble li { margin-bottom: 3px !important; }
.bubble strong { font-weight: 600 !important; }
.bubble a  { color: #2563eb !important; text-decoration: underline; }

/* === Not Found Bubble === */
.not-found-bubble {
    background: #fff7ed !important;
    border-color: #fed7aa !important;
    color: #7c2d12 !important;
}
.not-found-bubble a {
    color: #2563eb !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
}

/* === Source Links === */
.sources {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    color: #1d4ed8;
    font-size: 11px;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.source-chip:hover { background: #dbeafe; }
.source-chip::before { content: '↗'; font-size: 9px; opacity: 0.7; }

/* === Suggestions === */
#orbit-suggestions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    scrollbar-width: none;
}
#orbit-suggestions::-webkit-scrollbar { display: none; }
#orbit-suggestions button {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
#orbit-suggestions button:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* === Input Area === */
#orbit-bottom {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    align-items: center;
}
#orbit-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s, background 0.2s;
}
#orbit-input:focus {
    border-color: #2563eb;
    background: #fff;
}
#orbit-input::placeholder { color: #94a3b8; }
#orbit-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563eb;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
#orbit-send:hover { background: #1d4ed8; }
#orbit-send:active { transform: scale(0.92); }

/* === Typing Indicator === */
.typing {
    display: flex;
    gap: 4px;
    padding: 2px;
    align-items: center;
}
.typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: orbitBounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes orbitBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

/* === Mobile === */
@media (max-width: 480px) {
    #orbit-chatbox {
        width: 100%;
        height: 100%;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
}
