:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --sidebar-bg: #fff;
    --border-color: #dee2e6;
    --card-bg: #fff;
    --nav-hover: #e9ecef;
    --msg-user-bg: #fff;
    --msg-user-border: #dee2e6;
    --msg-user-text: #212529;
    --msg-assistant-text: #212529;
    --text-muted: #6c757d;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --sidebar-bg: #1e1e1e;
    --border-color: #333;
    --card-bg: #1e1e1e;
    --nav-hover: #2d2d2d;
    --msg-user-bg: #2d2d2d;
    --msg-user-border: #444;
    --msg-user-text: #e0e0e0;
    --msg-assistant-text: #e0e0e0;
    --text-muted: #a0a0a0;
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.sidebar { 
    background-color: var(--sidebar-bg); 
    min-height: 100vh; 
    border-right: 1px solid var(--border-color); 
    padding: 20px; 
    transition: background-color 0.3s, border-color 0.3s;
}

.content { 
    padding: 7px 15px; 
    height: 100vh; 
    overflow-y: auto; 
}

.card { 
    border-radius: 10px; 
    border: none; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    margin-bottom: 20px; 
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.card-header {
    background-color: var(--card-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.nav-pills .nav-link.active { 
    background-color: #0d6efd; 
    color: white; 
}

.nav-link { 
    color: var(--text-color); 
    border-radius: 8px; 
    margin-bottom: 5px; 
    cursor: pointer; 
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover { 
    background-color: var(--nav-hover); 
    color: var(--text-color); 
}

#chat-window { 
    height: calc(100vh - 400px); 
    min-height: 450px; 
    overflow-y: auto; 
    background-color: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    padding: 20px; 
    margin-bottom: 15px; 
    transition: background-color 0.3s, border-color 0.3s;
}

.chat-message { 
    margin-bottom: 10px; 
    padding: 12px 16px; 
    border-radius: 10px; 
    max-width: 85%; 
    word-wrap: break-word; 
}

.chat-message p:last-child { margin-bottom: 0; }
.chat-message ul { margin-bottom: 0; padding-left: 20px; }

.chat-message pre { 
    background: rgba(0,0,0,0.05); 
    padding: 8px; 
    border-radius: 5px; 
    margin-top: 8px; 
}

[data-theme="dark"] .chat-message pre { 
    background: rgba(255,255,255,0.05); 
}

.chat-message code { 
    background: rgba(0,0,0,0.05); 
    padding: 2px 4px; 
    border-radius: 3px; 
}

[data-theme="dark"] .chat-message code { 
    background: rgba(255,255,255,0.05); 
}

.chat-message h1 { font-size: 1.5rem; margin-top: 10px; margin-bottom: 10px; }
.chat-message h2 { font-size: 1.25rem; margin-top: 10px; margin-bottom: 10px; }
.chat-message h3 { font-size: 1.1rem; margin-top: 10px; margin-bottom: 10px; }

.msg-user { 
    background-color: var(--msg-user-bg); 
    color: var(--msg-user-text); 
    border: 1px solid var(--msg-user-border); 
    margin-left: auto; 
    border-bottom-right-radius: 2px; 
    width: fit-content; 
}

.msg-assistant { 
    background-color: transparent; 
    color: var(--msg-assistant-text); 
    margin-right: auto; 
    border-bottom-left-radius: 2px; 
    padding-left: 0; 
}

.top-header { 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 5px; 
    margin-bottom: 10px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.agent-info { 
    font-size: 0.9rem; 
    color: var(--text-muted); 
}

.attention-text { 
    color: #d63384; 
    font-weight: 500; 
    font-size: 0.8rem; 
}

.text-muted { color: var(--text-muted) !important; }

.list-group-item { 
    background-color: var(--card-bg); 
    color: var(--text-color); 
    border-color: var(--border-color); 
}

.table { color: var(--text-color); }
.table-hover tbody tr:hover { 
    background-color: var(--nav-hover); 
    color: var(--text-color); 
}

.modal-content { 
    background-color: var(--card-bg); 
    color: var(--text-color); 
}

.modal-header, .modal-footer { 
    border-color: var(--border-color); 
}

.form-control { 
    background-color: var(--bg-color); 
    color: var(--text-color); 
    border-color: var(--border-color); 
}

.form-control:focus { 
    background-color: var(--bg-color); 
    color: var(--text-color); 
}

[data-theme="dark"] .form-control { 
    background-color: #2d2d2d; 
    color: #e0e0e0; 
    border-color: #444; 
}

[data-theme="dark"] .form-control:focus { 
    background-color: #2d2d2d; 
    color: #e0e0e0; 
}

[data-theme="dark"] .btn-close { 
    filter: invert(1) grayscale(100%) brightness(200%); 
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.theme-toggle:hover {
    color: var(--text-color);
}

/* Custom Scrollbar for a more premium feel */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
