/* Dark theme: loaded after style.css / fixes.css to override the NiceAdmin light palette.
   Change the variables below to retune the whole site. */
:root {
  --dk-bg: #2b2b2b;          /* page background */
  --dk-surface: #353535;     /* cards, header, sidebar, dropdowns */
  --dk-surface-2: #404040;   /* hover / table heads / inputs */
  --dk-border: #4a4a4a;
  --dk-text: #e4e4e4;        /* body text */
  --dk-text-muted: #a8a8a8;
  --dk-heading: #f5f5f5;
  --dk-accent: #8fa2ff;      /* links / active items (lightened NiceAdmin blue) */
  --dk-accent-hover: #b4c0ff;

  color-scheme: dark;

  /* Bootstrap 5.2 variables */
  --bs-body-bg: var(--dk-bg);
  --bs-body-color: var(--dk-text);
  --bs-border-color: var(--dk-border);
  --bs-link-color: var(--dk-accent);
  --bs-link-hover-color: var(--dk-accent-hover);
}

body {
  background: var(--dk-bg);
  color: var(--dk-text);
}

a { color: var(--dk-accent); }
a:hover { color: var(--dk-accent-hover); }

h1, h2, h3, h4, h5, h6,
.pagetitle h1, .card-title, .logo span,
.dashboard .info-card h6, .profile .profile-card h2,
.contact .info-box h3, .iconslist .icon {
  color: var(--dk-heading);
}

.text-muted, .small.text-muted, .card-title span, .breadcrumb, .breadcrumb a,
.breadcrumb .breadcrumb-item::before, .sidebar-nav .nav-heading,
.dashboard .activity .activity-item .activite-label, .dashboard .news p,
.iconslist .label, .faq .basic p, .profile .profile-overview .label,
.profile .profile-edit label, .header-nav .notifications .notification-item p,
.header-nav .messages .message-item p {
  color: var(--dk-text-muted) !important;
}
.breadcrumb a:hover, .breadcrumb .active { color: var(--dk-text); }

/* ---------- Surfaces ---------- */
.header, .sidebar, .sidebar::-webkit-scrollbar, .card, .card-footer,
.modal-content, .dropdown-menu, .dropdown-menu-arrow::before,
.accordion-item, .accordion-button, .list-group-item, .iconslist .icon,
.public-header, .bg-white, .bg-light {
  background-color: var(--dk-surface) !important;
  color: var(--dk-text);
  border-color: var(--dk-border) !important;
}
.header { box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4); }
.sidebar { box-shadow: 0 0 20px rgba(0, 0, 0, 0.4); scrollbar-color: #666 transparent; }
.sidebar::-webkit-scrollbar-thumb { background-color: #666; }
.card { box-shadow: 0 0 20px rgba(0, 0, 0, 0.35); }
.card-header { background-color: var(--dk-surface-2); border-color: var(--dk-border); color: var(--dk-text); }
.card-footer { color: var(--dk-text-muted); }
.card-img-overlay { background-color: rgba(0, 0, 0, 0.6); }

/* ---------- Header / dropdowns ---------- */
.header .toggle-sidebar-btn, .header-nav .nav-icon, .header-nav .nav-profile,
.header .search-form button i, .header-nav .messages .message-item h4,
.header-nav .profile .dropdown-header h6, .dropdown-menu .dropdown-footer a,
.dropdown-item, .dropdown-header {
  color: var(--dk-text);
}
.header .search-bar { background: var(--dk-surface); }
.dropdown-item:hover, .dropdown-item:focus,
.dropdown-menu .dropdown-item:hover,
.header-nav .notifications .notification-item:hover,
.header-nav .messages .message-item:hover,
.header-nav .profile .dropdown-item:hover {
  background-color: var(--dk-surface-2);
  color: var(--dk-heading);
}
.dropdown-divider, hr { border-color: var(--dk-border); color: var(--dk-border); }

/* ---------- Sidebar ---------- */
.sidebar-nav .nav-link,
.sidebar-nav .nav-link:hover {
  background: var(--dk-surface-2);
  color: var(--dk-accent);
}
.sidebar-nav .nav-link i,
.sidebar-nav .nav-link:hover i { color: var(--dk-accent); }
.sidebar-nav .nav-link.collapsed { background: var(--dk-surface); color: var(--dk-text); }
.sidebar-nav .nav-link.collapsed:hover { background: var(--dk-surface-2); color: var(--dk-accent); }
.sidebar-nav .nav-link.collapsed i { color: var(--dk-text-muted); }
.sidebar-nav .nav-content a { color: var(--dk-text); }
.sidebar-nav .nav-content a:hover,
.sidebar-nav .nav-content a.active { color: var(--dk-accent); }

/* ---------- Tables ---------- */
.table {
  --bs-table-color: var(--dk-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--dk-border);
  --bs-table-striped-color: var(--dk-text);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
  --bs-table-hover-color: var(--dk-heading);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.07);
  --bs-table-active-color: var(--dk-heading);
  --bs-table-active-bg: rgba(255, 255, 255, 0.1);
  color: var(--dk-text);
  border-color: var(--dk-border);
}
.table-light, .table thead, .dashboard .recent-sales .table thead, .dashboard .top-selling .table thead {
  --bs-table-color: var(--dk-heading);
  --bs-table-bg: var(--dk-surface-2);
  background: var(--dk-surface-2);
  color: var(--dk-heading);
}
.datatable-wrapper .datatable-input, .datatable-selector,
.dataTable-input, .dataTable-selector {
  background-color: var(--dk-surface-2);
  color: var(--dk-text);
  border-color: var(--dk-border);
}
.dataTable-pagination a, .datatable-pagination a { color: var(--dk-text); }
.dataTable-pagination .active a, .datatable-pagination .datatable-active a,
.dataTable-pagination a:hover, .datatable-pagination a:hover {
  background-color: var(--dk-surface-2);
}
.dataTable-sorter::before { border-top-color: var(--dk-text-muted); }
.dataTable-sorter::after { border-bottom-color: var(--dk-text-muted); }

/* ---------- Forms ---------- */
.form-control, .form-select, .input-group-text,
.form-control:disabled, .form-control[readonly], .form-select:disabled {
  background-color: var(--dk-surface-2);
  color: var(--dk-text);
  border-color: var(--dk-border);
}
.form-control:focus, .form-select:focus {
  background-color: var(--dk-surface-2);
  color: var(--dk-heading);
  border-color: var(--dk-accent);
  box-shadow: 0 0 0 0.2rem rgba(143, 162, 255, 0.25);
}
.form-control::placeholder { color: #8a8a8a; }
.form-select {
  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='%23d0d0d0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.form-check-input { background-color: var(--dk-surface-2); border-color: #777; }
.form-check-input:checked { background-color: #4154f1; border-color: #4154f1; }
.form-label, label, .col-form-label { color: var(--dk-text); }
.form-text { color: var(--dk-text-muted); }

/* ---------- Buttons ---------- */
.btn-light { background-color: var(--dk-surface-2); border-color: var(--dk-border); color: var(--dk-text); }
.btn-outline-secondary, .btn-outline-dark { color: var(--dk-text); border-color: #777; }
.btn-outline-secondary:hover, .btn-outline-dark:hover { background-color: var(--dk-surface-2); color: var(--dk-heading); }
.btn-outline-primary { color: var(--dk-accent); border-color: var(--dk-accent); }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ---------- Misc components ---------- */
.text-dark, .text-black { color: var(--dk-text) !important; }
.text-secondary { color: var(--dk-text-muted) !important; }
.accordion-button:not(.collapsed) { background-color: var(--dk-surface-2) !important; color: var(--dk-heading); }
.accordion-button::after { filter: invert(1); }
.accordion-flush .accordion-body { color: var(--dk-text); }
.nav-tabs { border-color: var(--dk-border); }
.nav-tabs .nav-link { color: var(--dk-text-muted); }
.nav-tabs .nav-link.active,
.nav-tabs-bordered .nav-link.active {
  background-color: var(--dk-surface);
  color: var(--dk-accent);
  border-color: var(--dk-border) var(--dk-border) var(--dk-surface);
}
.nav-tabs-bordered { border-bottom-color: var(--dk-border); }
.nav-tabs-bordered .nav-link { color: var(--dk-text); }
.nav-tabs-bordered .nav-link.active { border-bottom: 2px solid var(--dk-accent); }
.page-link { background-color: var(--dk-surface); border-color: var(--dk-border); color: var(--dk-accent); }
.page-item.disabled .page-link { background-color: var(--dk-surface); color: var(--dk-text-muted); }
.list-group-item-action:hover { background-color: var(--dk-surface-2) !important; }
.dashboard .filter .icon, .dashboard .filter .dropdown-header h6 { color: var(--dk-text-muted); }
.dashboard .news h4 a { color: var(--dk-heading); }
.dashboard .activity .activity-item .activite-label::before { background-color: var(--dk-border); }
.dashboard .activity .activity-item .activity-badge { border-color: var(--dk-surface); }
.dashboard .sales-card .card-icon { background: rgba(65, 84, 241, 0.2); color: var(--dk-accent); }
.dashboard .revenue-card .card-icon { background: rgba(46, 202, 106, 0.2); }
.dashboard .customers-card .card-icon { background: rgba(255, 119, 29, 0.2); }

/* Light "-light" helper backgrounds become tinted dark versions */
.bg-primary-light   { background-color: rgba(13, 110, 253, 0.2) !important; border-color: transparent !important; }
.bg-secondary-light { background-color: rgba(108, 117, 125, 0.25) !important; border-color: transparent !important; }
.bg-success-light   { background-color: rgba(25, 135, 84, 0.25) !important; border-color: transparent !important; }
.bg-danger-light    { background-color: rgba(220, 53, 69, 0.25) !important; border-color: transparent !important; }
.bg-warning-light   { background-color: rgba(255, 193, 7, 0.2) !important; border-color: transparent !important; }
.bg-info-light      { background-color: rgba(13, 202, 240, 0.2) !important; border-color: transparent !important; }
.bg-dark-light      { background-color: rgba(255, 255, 255, 0.08) !important; border-color: transparent !important; }

/* Quill editor */
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--dk-border); }
.ql-snow .ql-stroke { stroke: var(--dk-text); }
.ql-snow .ql-fill { fill: var(--dk-text); }
.ql-snow .ql-picker { color: var(--dk-text); }
.ql-editor.ql-blank::before { color: var(--dk-text-muted); }

/* Footer */
.footer { border-top-color: var(--dk-border) !important; color: var(--dk-text-muted); }
.footer .copyright { color: var(--dk-text-muted); }
