/* ==========================================================================
   LIGHT MODE DESIGN SYSTEM - logiSA Dashboard
   Checked thoroughly across all pages, components, tabs, canvas, and modals
   ========================================================================== */

/* --- 1. Global Base Theme --- */
html.theme-light,
html.theme-light body {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

/* --- 2. Top Header & Sidebar Navigation --- */
html.theme-light header {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

html.theme-light aside {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

html.theme-light main {
    background-color: #f8fafc !important;
}

html.theme-light #topConnectionPill {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
}

html.theme-light #topConnectionPill span:last-child {
    color: #334155 !important;
}

html.theme-light header .bg-slate-800\/50,
html.theme-light header .bg-slate-800\/80 {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
}

html.theme-light #topUserSelector {
    color: #0f172a !important;
}

html.theme-light #topUserSelector option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* Sidebar Nav Links */
html.theme-light .nav-item {
    color: #475569 !important;
}

html.theme-light .nav-item:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.nav-item.nav-active {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

.nav-item.nav-active i {
    color: #f8fafc !important;
}

html.theme-light .nav-item.nav-active {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

html.theme-light .nav-item.nav-active i {
    color: #0f172a !important;
}

/* --- Standardized Clean Neutral Buttons --- */
.btn-primary {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #e2e8f0 !important;
}

.btn-primary:hover {
    background-color: #ffffff !important;
}

html.theme-light .btn-primary {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid #0f172a !important;
}

html.theme-light .btn-primary:hover {
    background-color: #1e293b !important;
}

.btn-secondary {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
    border: 1px solid #334155 !important;
}

.btn-secondary:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

html.theme-light .btn-secondary {
    background-color: #ffffff !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

html.theme-light .btn-secondary:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

/* --- 3. Cards, Glass Panels & Generic Containers --- */
html.theme-light .glass-panel,
html.theme-light .card-glass {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05) !important;
}

html.theme-light .bg-slate-950 {
    background-color: #f8fafc !important;
}

html.theme-light .bg-slate-900,
html.theme-light .bg-slate-900\/80,
html.theme-light .bg-slate-900\/90,
html.theme-light .bg-slate-900\/60,
html.theme-light .bg-slate-900\/50,
html.theme-light .bg-slate-900\/40,
html.theme-light .bg-slate-900\/30 {
    background-color: #ffffff !important;
}

html.theme-light .bg-slate-800,
html.theme-light .bg-slate-800\/80,
html.theme-light .bg-slate-800\/60,
html.theme-light .bg-slate-800\/50,
html.theme-light .bg-slate-800\/40 {
    background-color: #f1f5f9 !important;
}

html.theme-light .hover\:bg-slate-800:hover,
html.theme-light .hover\:bg-slate-800\/60:hover,
html.theme-light .hover\:bg-slate-800\/80:hover,
html.theme-light .hover\:bg-slate-700:hover {
    background-color: #e2e8f0 !important;
}

html.theme-light .hover\:bg-slate-900:hover,
html.theme-light .hover\:bg-slate-900\/80:hover {
    background-color: #f1f5f9 !important;
}

/* --- 4. Borders & Dividers --- */
html.theme-light .border-slate-800,
html.theme-light .border-slate-700,
html.theme-light .border-slate-800\/80,
html.theme-light .border-slate-700\/80,
html.theme-light .border-slate-800\/50,
html.theme-light .border-slate-800\/30 {
    border-color: #e2e8f0 !important;
}

html.theme-light .divide-slate-800 > :not([hidden]) ~ :not([hidden]),
html.theme-light .divide-slate-700 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e2e8f0 !important;
}

/* --- 5. High Contrast Text Hierarchy --- */
html.theme-light .text-white {
    color: #0f172a !important;
}

html.theme-light .text-slate-100,
html.theme-light .text-slate-200 {
    color: #1e293b !important;
}

html.theme-light .text-slate-300 {
    color: #334155 !important;
}

html.theme-light .text-slate-400 {
    color: #64748b !important;
}

html.theme-light .text-slate-500 {
    color: #64748b !important;
}

/* --- 6. Form Controls: Inputs, Selects, Textareas --- */
html.theme-light input,
html.theme-light select,
html.theme-light textarea {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

html.theme-light input:focus,
html.theme-light select:focus,
html.theme-light textarea:focus {
    border-color: #6366f1 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15) !important;
}

html.theme-light input::placeholder,
html.theme-light textarea::placeholder {
    color: #94a3b8 !important;
}

html.theme-light select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* --- 7. Tab 0: Workflow Canvas Studio --- */
html.theme-light #tab-workflow {
    background-color: #f1f5f9 !important;
}

html.theme-light .karavan-grid {
    background-color: #f8fafc !important;
    background-image: radial-gradient(circle, rgba(148, 163, 184, 0.45) 1.5px, transparent 1.5px) !important;
}

html.theme-light .karavan-node {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04) !important;
}

html.theme-light .karavan-node.node-selected {
    box-shadow: 0 0 0 2px #6366f1, 0 8px 16px -4px rgba(99, 102, 241, 0.2) !important;
}

html.theme-light .node-header {
    border-bottom: 1px solid #f1f5f9;
}

html.theme-light .node-label {
    color: #0f172a !important;
}

html.theme-light .node-config-preview {
    color: #475569 !important;
}

html.theme-light .flow-wire {
    stroke: #6366f1 !important;
}

html.theme-light #canvasToolbar {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

html.theme-light #nodeInspectorDrawer,
html.theme-light #nodePaletteDrawer {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* --- 8. Tab 1: Zalo Accounts & Sessions --- */
html.theme-light #tab-zalo {
    background-color: #f8fafc !important;
}

html.theme-light .session-card {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.theme-light #qrCodeBox {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
}

/* --- 9. Tab 2: Zalo style customer inbox --- */
html.theme-light #tab-chat {
    background-color: #eef1f5 !important;
}

html.theme-light #chatWorkspace {
    background: #ffffff !important;
    border-color: #dce2e9 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
}

html.theme-light #chatSidebar,
html.theme-light #chatSidebarToolbar,
html.theme-light #chatSidebarFooter,
html.theme-light #chatHeader,
html.theme-light #chatComposer {
    background: #ffffff !important;
    border-color: #e5e9ef !important;
}

html.theme-light #chatSidebar {
    border-right-color: #e5e9ef !important;
}

html.theme-light #chatSidebarToolbar .bg-slate-900\/90 {
    background: #f1f3f6 !important;
    border-color: #e1e5eb !important;
}

html.theme-light #chatMainPane {
    background: #f4f6f8 !important;
}

html.theme-light #chatMessagesBox {
    background: #f4f6f8 !important;
}

html.theme-light #conversationHistoryControls {
    background: #ffffff !important;
    border-color: #e5e9ef !important;
}

html.theme-light .conversation-row {
    border-bottom-color: #edf0f3 !important;
    border-radius: 0 !important;
    color: #334155 !important;
}

html.theme-light .conversation-row-inactive:hover {
    background: #f5f7fa !important;
}

html.theme-light .conversation-row-active {
    background: #eaf2ff !important;
    border-left-color: #0068ff !important;
    box-shadow: none !important;
}

html.theme-light .conversation-title-active {
    color: #075bc7 !important;
}

html.theme-light .conversation-avatar-direct {
    background: #e8f1ff !important;
    border-color: #cfe0ff !important;
    color: #1764c0 !important;
}

html.theme-light .conversation-avatar-group {
    background: #f0eaff !important;
    border-color: #ddd0ff !important;
    color: #6941a5 !important;
}

html.theme-light .conversation-online-dot {
    border-color: #ffffff !important;
}

html.theme-light .chat-filter-active {
    background: #0068ff !important;
    color: #ffffff !important;
}

html.theme-light .chat-filter-inactive {
    color: #475569 !important;
}

html.theme-light .chat-filter-inactive:hover {
    background: #e5eaf1 !important;
    color: #1e293b !important;
}

html.theme-light #chatMessagesBox .chat-bubble-outgoing {
    background: #0068ff !important;
    border-color: #0068ff !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(0, 70, 180, 0.16) !important;
}

html.theme-light #chatMessagesBox .chat-bubble-outgoing * {
    color: #ffffff !important;
}

html.theme-light #chatMessagesBox .chat-bubble-incoming {
    background: #ffffff !important;
    border-color: #e1e5eb !important;
    color: #1f2937 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}

html.theme-light #chatMessagesBox .chat-bubble-incoming .text-slate-100 {
    color: #1f2937 !important;
}

html.theme-light #chatMessagesBox .chat-image-component .absolute.text-white {
    color: #ffffff !important;
}

html.theme-light #chatMessagesBox .chat-image-component .absolute .text-slate-300 {
    color: #e2e8f0 !important;
}

html.theme-light #chatMessagesBox .chat-album .text-sky-400,
html.theme-light #chatMessagesBox .chat-sender-name {
    color: #0369a1 !important;
}

html.theme-light #chatMessagesBox .chat-message-meta {
    color: #64748b !important;
}

html.theme-light #chatMessagesBox .chat-message-meta .text-blue-400 {
    color: #2563eb !important;
}

html.theme-light #chatMessagesBox .chat-image-component .chat-photo-grid,
html.theme-light #chatMessagesBox .chat-image-component .chat-photo-tile {
    background-color: #e6e9ef !important;
}

html.theme-light #chatMessagesBox .chat-image-component .chat-photo-card:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18) !important;
}

html.theme-light .chat-bot-badge {
    background: #e8f1ff !important;
    border-color: #cfe0ff !important;
    color: #075bc7 !important;
}

html.theme-light .chat-handover-badge {
    background: #fff7e6 !important;
    border-color: #f6d58d !important;
    color: #8a5700 !important;
}

html.theme-light .chat-handover-status-human {
    background: #fff7e6 !important;
    border-color: #f6d58d !important;
    color: #8a5700 !important;
}

html.theme-light .chat-handover-status-bot {
    background: #e8f7ef !important;
    border-color: #b9e5cb !important;
    color: #166534 !important;
}

html.theme-light #activeChatAvatar {
    background: #e8f1ff !important;
    border-color: #cfe0ff !important;
    color: #1764c0 !important;
}

html.theme-light #activeChatOnlineDot {
    border-color: #ffffff !important;
}

html.theme-light .chat-handover-button {
    background: #fff7e6 !important;
    border-color: #f6d58d !important;
    color: #8a5700 !important;
}

html.theme-light .chat-handover-button:hover {
    background: #ffefc2 !important;
}

html.theme-light #btnToggleHandover .text-emerald-400,
html.theme-light #btnToggleHandover .text-amber-400 {
    color: currentColor !important;
}

#chatMessagesBox .chat-media-component {
    max-width: 100%;
}

#chatMessagesBox.chat-message-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#chatMessagesBox > .chat-message-row {
    flex: none;
    margin-block: 0;
}

#chatMessagesBox > .chat-message-row:not(.chat-message-row-grouped) {
    margin-block-start: 8px;
}

#chatMessagesBox > .chat-message-row.chat-message-row-grouped {
    margin-block-start: 2px;
}

#chatMessagesBox .chat-image-component + .chat-text-component {
    margin-top: 0.35rem;
}

.chat-photo-card img {
    display: block;
}

html.theme-light .chat-unread-badge {
    background: #e5484d !important;
    color: #ffffff !important;
}

html.theme-light #chatComposer .border-slate-800,
html.theme-light #chatComposer .border-slate-800\/60 {
    border-color: #edf0f3 !important;
}

html.theme-light #chatComposer .hover\:bg-slate-800:hover {
    background: #f1f3f6 !important;
    color: #1e293b !important;
}

html.theme-light .chat-send-button {
    background: #0068ff !important;
    color: #ffffff !important;
    box-shadow: 0 2px 5px rgba(0, 104, 255, 0.2) !important;
}

html.theme-light .chat-send-button:hover {
    background: #005be0 !important;
}

/* --- 10. Tab 3: Users & Sessions --- */
html.theme-light #tab-users {
    background-color: #f8fafc !important;
}

html.theme-light .user-card-item {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* --- 11. Tab 4: AI-Core 8 Modules --- */
html.theme-light #tab-core {
    background-color: #f8fafc !important;
}

html.theme-light .module-card {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.theme-light .telemetry-stat-card {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* --- 12. Tab 5: Tools & MCP --- */
html.theme-light #tab-tools {
    background-color: #f8fafc !important;
}

html.theme-light .tool-item-card {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* --- 13. Tab 6: Cấu hình AI & Gateway Hub --- */
html.theme-light #tab-ai,
html.theme-light #tab-nine-router {
    background-color: #f8fafc !important;
}

html.theme-light #tab-ai > div:first-child,
html.theme-light #tab-nine-router > div:first-child {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* --- 15. Tab 8: System Logs --- */
html.theme-light #tab-logs {
    background-color: #f8fafc !important;
}

html.theme-light #logsConsole {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* --- 16. Modals, Drawers & Overlays --- */
html.theme-light #modalAuthLogin > div,
html.theme-light #modalInteractiveSimulator > div,
html.theme-light #qrModal > div {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

html.theme-light #modalAuthLogin,
html.theme-light #modalInteractiveSimulator,
html.theme-light #qrModal {
    background-color: rgba(15, 23, 42, 0.45) !important;
}

/* --- 17. Scrollbars --- */
html.theme-light * {
    scrollbar-color: rgba(148, 163, 184, 0.7) transparent !important;
}

html.theme-light ::-webkit-scrollbar-track {
    background: transparent !important;
}

html.theme-light ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5) !important;
    border-radius: 9999px !important;
}

html.theme-light ::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.8) !important;
}
