/* ═══════════════════════════════════════════════════
   Global Light/Dark Theme System
   Dark: Purple + Cyan | Light: White + Orange
   ═══════════════════════════════════════════════════ */

:root, [data-theme="dark"] {
    --t-bg: #0a0a1a;
    --t-bg2: #0f0f23;
    --t-bg-secondary: #1a1a3e;
    --t-bg-tertiary: #252550;
    --t-bg-input: #252550;
    --t-glass-bg: rgba(26, 26, 62, 0.6);
    --t-glass-border: rgba(255, 255, 255, 0.08);
    --t-text: #e2e8f0;
    --t-text2: #94a3b8;
    --t-muted: #64748b;
    --t-heading: #f1f5f9;
    --t-divider: rgba(255, 255, 255, 0.06);
    --t-card: rgba(15, 15, 35, 0.6);
    --t-card-border: rgba(255, 255, 255, 0.06);
    --t-navbar: rgba(10, 10, 26, 0.8);
    --t-navbar-border: rgba(255, 255, 255, 0.05);
    --t-sidebar: #1a1a3e;
    --t-sidebar-border: rgba(255, 255, 255, 0.08);
    --t-topbar: rgba(15, 15, 35, 0.85);
    --t-th-bg: rgba(15, 15, 35, 0.5);
    --t-td-border: rgba(255, 255, 255, 0.03);
    --t-avatar-border: rgba(255, 255, 255, 0.15);
    --t-avatar-color: #fff;
    --t-credit-bg: rgba(16, 185, 129, 0.12);
    --t-credit-color: #34d399;
    --t-credit-border: rgba(16, 185, 129, 0.2);
    --t-logout-bg: rgba(239, 68, 68, 0.1);
    --t-logout-color: #f87171;
    --t-logout-border: rgba(239, 68, 68, 0.15);
    --t-badge-success-bg: rgba(16, 185, 129, 0.15);
    --t-badge-success: #34d399;
    --t-badge-danger-bg: rgba(239, 68, 68, 0.15);
    --t-badge-danger: #f87171;
    --t-badge-warning-bg: rgba(245, 158, 11, 0.15);
    --t-badge-warning: #fbbf24;
    --t-badge-info-bg: rgba(6, 182, 212, 0.15);
    --t-badge-info: #67e8f9;
    --t-alert-info-bg: rgba(6, 182, 212, 0.12);
    --t-alert-info-color: #67e8f9;
    --t-alert-info-border: rgba(6, 182, 212, 0.2);
    --t-shadow: 0 4px 16px rgba(0,0,0,0.3);
    --t-close-filter: invert(1);
    --t-scrollbar-track: #0a0a1a;
    --t-scrollbar-thumb: #252550;
    --t-banner: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(6,182,212,0.05));
    --t-tx-bg: rgba(255,255,255,0.02);
    --t-tx-border: rgba(255,255,255,0.05);
    --t-tab-active-bg: #252550;
    --t-tab-active-color: #fff;
    --t-tab-color: #94a3b8;
    --t-tab-border: rgba(255, 255, 255, 0.08);
    --t-link: #a78bfa;
    --t-link-hover: #c4b5fd;
    --t-accent: #7c3aed;
    --t-accent2: #06b6d4;
    --t-input-placeholder: #64748b;
    --t-hover-bg: rgba(124, 58, 237, 0.05);
}

/* ─── Light Theme: White + Orange ─────────────── */
[data-theme="light"] {
    --t-bg: #f5f5f5;
    --t-bg2: #eeeeee;
    --t-bg-secondary: #ffffff;
    --t-bg-tertiary: #fafafa;
    --t-bg-input: #ffffff;
    --t-glass-bg: #ffffff;
    --t-glass-border: #e0e0e0;
    --t-text: #212121;
    --t-text2: #555555;
    --t-muted: #888888;
    --t-heading: #1a1a1a;
    --t-divider: #e0e0e0;
    --t-card: #ffffff;
    --t-card-border: #e0e0e0;
    --t-navbar: #ffffff;
    --t-navbar-border: #e0e0e0;
    --t-sidebar: #ffffff;
    --t-sidebar-border: #e8e8e8;
    --t-topbar: #ffffff;
    --t-th-bg: #fafafa;
    --t-td-border: #f0f0f0;
    --t-avatar-border: #e0e0e0;
    --t-avatar-color: #555555;
    --t-credit-bg: #e8f5e9;
    --t-credit-color: #2e7d32;
    --t-credit-border: #c8e6c9;
    --t-logout-bg: #ffebee;
    --t-logout-color: #c62828;
    --t-logout-border: #ffcdd2;
    --t-badge-success-bg: #e8f5e9;
    --t-badge-success: #2e7d32;
    --t-badge-danger-bg: #ffebee;
    --t-badge-danger: #c62828;
    --t-badge-warning-bg: #fff3e0;
    --t-badge-warning: #e65100;
    --t-badge-info-bg: #e3f2fd;
    --t-badge-info: #1565c0;
    --t-alert-info-bg: #fff3e0;
    --t-alert-info-color: #e65100;
    --t-alert-info-border: #ffe0b2;
    --t-shadow: 0 1px 4px rgba(0,0,0,0.08);
    --t-close-filter: none;
    --t-scrollbar-track: #f5f5f5;
    --t-scrollbar-thumb: #bdbdbd;
    --t-banner: linear-gradient(135deg, rgba(245,124,0,0.06), rgba(255,152,0,0.04));
    --t-tx-bg: #ffffff;
    --t-tx-border: #e0e0e0;
    --t-tab-active-bg: #ffffff;
    --t-tab-active-color: #e65100;
    --t-tab-color: #555555;
    --t-tab-border: #e0e0e0;
    --t-link: #e65100;
    --t-link-hover: #bf360c;
    --t-accent: #f57c00;
    --t-accent2: #ff9800;
    --t-input-placeholder: #bdbdbd;
    --t-hover-bg: rgba(245, 124, 0, 0.04);
}

/* ── Theme Toggle Button ──────────────────────── */
.theme-toggle {
    background: var(--t-bg-tertiary);
    border: 1px solid var(--t-glass-border);
    color: var(--t-text2);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem; transition: all 0.3s;
}
.theme-toggle:hover { color: var(--t-accent); border-color: var(--t-accent); }

/* ═══════════════════════════════════════════════════
   Light theme — White + Orange component overrides
   ═══════════════════════════════════════════════════ */

/* ── Forms ─────────────────────────────────────── */
[data-theme="light"] .form-control {
    background-color: #ffffff !important;
    border-color: #e0e0e0 !important;
    color: #212121 !important;
}
[data-theme="light"] .form-select {
    background-color: #ffffff !important;
    border-color: #e0e0e0 !important;
    color: #212121 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23555555' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}
[data-theme="light"] .form-control:focus {
    border-color: #f57c00 !important;
    box-shadow: 0 0 0 3px rgba(245,124,0,0.12) !important;
    background-color: #ffffff !important;
}
[data-theme="light"] .form-select:focus {
    border-color: #f57c00 !important;
    box-shadow: 0 0 0 3px rgba(245,124,0,0.12) !important;
    background-color: #ffffff !important;
}
[data-theme="light"] .form-control:disabled {
    background-color: #fafafa !important;
    color: #888888 !important;
    border-color: #e0e0e0 !important;
}
[data-theme="light"] .form-select:disabled {
    background-color: #fafafa !important;
    color: #888888 !important;
    border-color: #e0e0e0 !important;
}
[data-theme="light"] .form-control::placeholder { color: #bdbdbd !important; }
[data-theme="light"] .form-label { color: #333333 !important; }
[data-theme="light"] .form-check-input { background-color: #fff; border-color: #e0e0e0; }
[data-theme="light"] .form-check-input:checked { background-color: #f57c00; border-color: #f57c00; }
[data-theme="light"] .input-group-text { background-color: #fafafa; border-color: #e0e0e0; color: #555555; }

/* ── Cards ──────────────────────────────────────── */
[data-theme="light"] .card {
    background: #ffffff !important;
    border-color: #e0e0e0 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    backdrop-filter: none;
}
[data-theme="light"] .card-header {
    background: #fafafa !important;
    border-bottom-color: #eeeeee !important;
    color: #212121;
}
[data-theme="light"] .card-body { color: #212121; }

/* ── Tables ─────────────────────────────────────── */
[data-theme="light"] .table { color: #212121; }
[data-theme="light"] .table > :not(caption) > * > * {
    color: #212121;
    border-bottom-color: #f0f0f0 !important;
    background-color: transparent !important;
}
[data-theme="light"] .table thead th {
    background: #fafafa !important;
    color: #555555;
    border-bottom-color: #e0e0e0 !important;
}
[data-theme="light"] .table tbody tr:hover { background: rgba(245,124,0,0.03) !important; }
[data-theme="light"] .table tbody tr:hover td { background-color: transparent !important; }

/* ── DataTables ─────────────────────────────────── */
[data-theme="light"] .dataTables_wrapper .dataTables_length,
[data-theme="light"] .dataTables_wrapper .dataTables_filter,
[data-theme="light"] .dataTables_wrapper .dataTables_info,
[data-theme="light"] .dataTables_wrapper .dataTables_paginate { color: #555555 !important; }
[data-theme="light"] .dataTables_wrapper .dataTables_filter input {
    background-color: #fff !important; border-color: #e0e0e0 !important; color: #212121 !important;
}
[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button { color: #555555 !important; }
[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #f57c00 !important; color: #fff !important; border: none !important;
}
[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #fff3e0 !important; color: #e65100 !important; border: none !important;
}
[data-theme="light"] table.dataTable tbody tr { background-color: transparent !important; }
[data-theme="light"] table.dataTable tbody tr:hover { background-color: rgba(245,124,0,0.03) !important; }

/* ── Sidebar ────────────────────────────────────── */
[data-theme="light"] .sidebar {
    background: #ffffff;
    border-right-color: #e8e8e8;
    box-shadow: 2px 0 8px rgba(0,0,0,0.03);
}
[data-theme="light"] .sidebar-brand { border-bottom-color: #eeeeee; }
[data-theme="light"] .sidebar-brand-text .site-name { color: #1a1a1a; }
[data-theme="light"] .sidebar-menu a { color: #555555; }
[data-theme="light"] .sidebar-menu a:hover { background: #fff3e0; color: #e65100; }
[data-theme="light"] .sidebar-menu a.active {
    background: linear-gradient(135deg, #f57c00, #ff9800);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245,124,0,0.25);
}
[data-theme="light"] .sidebar-menu .menu-label { color: #bdbdbd; }

/* ── Top Navbar ─────────────────────────────────── */
[data-theme="light"] .top-navbar {
    background: #ffffff;
    border-bottom-color: #e8e8e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
[data-theme="light"] .top-navbar .credit-badge {
    background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9;
}

/* ── Badges ─────────────────────────────────────── */
[data-theme="light"] .badge-success { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .badge-danger { background: #ffebee; color: #c62828; }
[data-theme="light"] .badge-warning { background: #fff3e0; color: #e65100; }
[data-theme="light"] .badge-info { background: #e3f2fd; color: #1565c0; }
[data-theme="light"] .badge-purple { background: #fff3e0; color: #e65100; }

/* ── Alerts ─────────────────────────────────────── */
[data-theme="light"] .alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
[data-theme="light"] .alert-danger { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
[data-theme="light"] .alert-info { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
[data-theme="light"] .alert .btn-close { filter: none; opacity: 0.6; }

/* ── Modal ──────────────────────────────────────── */
[data-theme="light"] .modal-content { background: #ffffff; border-color: #e0e0e0; color: #212121; }
[data-theme="light"] .modal-header { border-bottom-color: #eeeeee; }
[data-theme="light"] .modal-header .btn-close { filter: none; }
[data-theme="light"] .modal-footer { border-top-color: #eeeeee; }

/* ── Dropdown ───────────────────────────────────── */
[data-theme="light"] .dropdown-menu { background: #ffffff; border-color: #e0e0e0; box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
[data-theme="light"] .dropdown-item { color: #555555; }
[data-theme="light"] .dropdown-item:hover { background: #fff3e0; color: #e65100; }

/* ── Pagination ─────────────────────────────────── */
[data-theme="light"] .pagination .page-link { background: #fff; border-color: #e0e0e0; color: #555555; }
[data-theme="light"] .pagination .page-item.active .page-link { background: #f57c00; border-color: #f57c00; color: #fff; }

/* ── Stat Cards ─────────────────────────────────── */
[data-theme="light"] .stat-card {
    background: #ffffff; border-color: #e0e0e0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    backdrop-filter: none;
}
[data-theme="light"] .stat-card:hover {
    box-shadow: 0 4px 16px rgba(245,124,0,0.12);
    border-color: rgba(245,124,0,0.3);
}

/* ── Nav Tabs ───────────────────────────────────── */
[data-theme="light"] .nav-tabs { border-bottom-color: #e0e0e0; }
[data-theme="light"] .nav-tabs .nav-link { color: #555555; }
[data-theme="light"] .nav-tabs .nav-link:hover { color: #e65100; background: #fff3e0; }
[data-theme="light"] .nav-tabs .nav-link.active {
    background: #ffffff; color: #e65100; font-weight: 700;
    border-color: #e0e0e0 #e0e0e0 #ffffff;
}

/* ── Text ───────────────────────────────────────── */
[data-theme="light"] .text-muted { color: #888888 !important; }
[data-theme="light"] small.text-muted { color: #888888 !important; }
[data-theme="light"] .text-secondary { color: #555555 !important; }
[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3,
[data-theme="light"] h4, [data-theme="light"] h5, [data-theme="light"] h6 { color: #1a1a1a; }
[data-theme="light"] a { color: #e65100; }
[data-theme="light"] a:hover { color: #bf360c; }

/* ── Buttons ────────────────────────────────────── */
[data-theme="light"] .btn-primary { background: #f57c00; border-color: #f57c00; color: #fff; }
[data-theme="light"] .btn-primary:hover { background: #ef6c00; border-color: #ef6c00; }
[data-theme="light"] .btn-outline-secondary { color: #555555; border-color: #e0e0e0; }
[data-theme="light"] .btn-outline-secondary:hover { background: #fafafa; color: #212121; }
[data-theme="light"] .btn-outline-danger { color: #c62828; border-color: #ffcdd2; }
[data-theme="light"] .btn-outline-success { color: #2e7d32; border-color: #c8e6c9; }
[data-theme="light"] .btn-outline-warning { color: #e65100; border-color: #ffe0b2; }
[data-theme="light"] .btn-outline-info { color: #1565c0; border-color: #90caf9; }
[data-theme="light"] .btn-success { background: #2e7d32; border-color: #2e7d32; }
[data-theme="light"] .btn-danger { background: #c62828; border-color: #c62828; }

/* ── Code ───────────────────────────────────────── */
[data-theme="light"] pre { background: #fafafa; border-color: #e0e0e0; color: #212121; }
[data-theme="light"] code { background: #fff3e0; color: #e65100; }
[data-theme="light"] pre code { background: none; color: #212121; }

/* ── Misc ───────────────────────────────────────── */
[data-theme="light"] hr { border-color: #eeeeee; }

/* ── Gradient overrides (purple→orange in light) ─ */
[data-theme="light"] .gradient-bg-purple { background: linear-gradient(135deg, #f57c00, #ff9800); }
