/* --- Container & Positioning --- */
#orc-widget-container {
    position: fixed !important; /* Force fixed position */
    bottom: 20px !important;
    z-index: 2147483647 !important; /* Maximum possible Z-Index to stay on top */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: normal; /* Reset line-height to prevent theme conflicts */
}

/* Right vs Left Alignment */
.orc-pos-right { 
    right: 20px !important; 
    left: auto !important; 
}

.orc-pos-left { 
    left: 20px !important; 
    right: auto !important; 
}

/* Mobile Responsiveness Fix (Optional but Recommended) */
@media screen and (max-width: 480px) {
    #orc-widget-container {
        bottom: 10px !important;
    }
    .orc-pos-right { right: 10px !important; }
    .orc-pos-left { left: 10px !important; }
    
    #orc-chat-window {
        width: 300px; /* Slightly smaller on phones */
        height: 400px;
    }
}

/* --- The Floating Bubble --- */
#orc-chat-bubble {
    background-color: var(--orc-accent, #0073aa);
    /* Dynamic Size Variable */
    width: var(--orc-bubble-size, 60px);
    height: var(--orc-bubble-size, 60px);
    
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    padding: 0;
}

#orc-chat-bubble:hover {
    transform: scale(1.1);
}

#orc-chat-bubble svg {
    width: 50%;
    height: 50%;
}

/* --- The Chat Window --- */
#orc-chat-window {
    position: absolute;
    bottom: calc(var(--orc-bubble-size, 60px) + 20px); /* Dynamic spacing above bubble */
    width: 350px;
    height: 450px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.orc-pos-right #orc-chat-window { right: 0; }
.orc-pos-left #orc-chat-window { left: 0; }

#orc-chat-window.orc-hidden {
    display: none;
}

/* --- Header --- */
#orc-chat-header {
    background-color: var(--orc-accent, #0073aa);
    color: #fff;
    padding: 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.orc-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Avatar Styling */
.orc-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
    display: block;
}

#orc-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* --- Messages Area --- */
#orc-chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.orc-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Light Mode Colors */
.orc-light .orc-user-msg {
    align-self: flex-end;
    background-color: var(--orc-accent, #0073aa);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.orc-light .orc-bot-msg {
    align-self: flex-start;
    background-color: #e0e0e0;
    color: #333;
    border-bottom-left-radius: 2px;
}

/* --- Dark Mode Colors --- */
.orc-dark #orc-chat-window {
    background-color: #1f1f1f;
    border: 1px solid #333;
}

.orc-dark #orc-chat-messages {
    background-color: #121212;
}

.orc-dark .orc-user-msg {
    align-self: flex-end;
    background-color: var(--orc-accent, #0073aa);
    color: #fff;
}

.orc-dark .orc-bot-msg {
    align-self: flex-start;
    background-color: #333;
    color: #e0e0e0;
}

/* --- Input Area --- */
#orc-input-area {
    padding: 10px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    background: #fff;
}

.orc-dark #orc-input-area {
    background: #1f1f1f;
    border-top: 1px solid #333;
}

#orc-user-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

.orc-dark #orc-user-input {
    background: #2c2c2c;
    border: 1px solid #444;
    color: white;
}

#orc-send-btn {
    background: transparent;
    color: var(--orc-accent, #0073aa);
    border: none;
    cursor: pointer;
    padding: 0 10px;
}

#orc-send-btn:disabled {
    color: #ccc;
}