/* ==========================================================
   LUGINA THEME - Light / Dark Mode
   Aturan: tidak mengubah struktur, hanya variabel & override
   Toggle via html[data-bs-theme="light|dark"]
   Simpan preferensi di localStorage (lugina-theme + tabler-theme)
   ========================================================== */

/* ---------- LIGHT (default) - eksplisit ---------- */
:root,
html[data-bs-theme="light"] {
  --lugina-page: #f6f8fb;
  --lugina-bg: #f6f8fb;
  --lugina-card: #ffffff;
  --lugina-sidebar: #ffffff;
  --lugina-navbar: #ffffff;
  --lugina-border: #e6ebf2;
  --lugina-title: #182433;
  --lugina-text: #5f6b7a;
  --lugina-muted: #9aa6b2;

  --lugina-primary-soft: #edf5ff;
  --lugina-success-soft: #eaf8ee;
  --lugina-danger-soft: #fdeeee;
  --lugina-warning-soft: #fff7e6;
  --lugina-info-soft: #eef8ff;

  --tblr-body-bg: var(--lugina-page);
  --tblr-bg-surface: var(--lugina-card);
}

/* ---------- DARK ---------- */
html[data-bs-theme="dark"] {
  --lugina-page: #131a2b;
  --lugina-bg: #131a2b;
  --lugina-card: #1a2236;
  --lugina-sidebar: #1a2236;
  --lugina-navbar: #1a2236;
  --lugina-border: #243049;
  --lugina-title: #e6eaf2;
  --lugina-text: #c3ccdb;
  --lugina-muted: #8a97ad;

  --lugina-primary-soft: #1a2e5a;
  --lugina-success-soft: #143320;
  --lugina-danger-soft: #3b1a1e;
  --lugina-warning-soft: #3b2e14;
  --lugina-info-soft: #14334d;

  /* Tabler dark surface */
  --tblr-body-bg: var(--lugina-page);
  --tblr-bg-surface: var(--lugina-card);
  --tblr-border-color: #243049;
  --tblr-border-color-translucent: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

/* ---------- BASE ---------- */
html[data-bs-theme="dark"] body,
html[data-bs-theme="dark"] .page {
  background: var(--lugina-page) !important;
  color: var(--lugina-text);
}

/* ---------- NAVBAR ---------- */
html[data-bs-theme="dark"] .navbar {
  background: var(--lugina-navbar) !important;
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .navbar .input-icon input {
  background: #222d47 !important;
  color: var(--lugina-text);
  border: 1px solid var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .navbar .input-icon input::placeholder {
  color: var(--lugina-muted);
}
html[data-bs-theme="dark"] .navbar .input-icon input:focus {
  background: #1e293f !important;
  color: var(--lugina-title);
}

/* ---------- CARD ---------- */
html[data-bs-theme="dark"] .card {
  background: var(--lugina-card) !important;
  border-color: var(--lugina-border) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
}
html[data-bs-theme="dark"] .card-header,
html[data-bs-theme="dark"] .card-footer {
  background: transparent !important;
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .card-title,
html[data-bs-theme="dark"] .card .h1,
html[data-bs-theme="dark"] .card .h2,
html[data-bs-theme="dark"] .page-title,
html[data-bs-theme="dark"] .section-title,
html[data-bs-theme="dark"] .dash-cal-title,
html[data-bs-theme="dark"] .display-6 {
  color: var(--lugina-title) !important;
}

/* ---------- TABLE ---------- */
html[data-bs-theme="dark"] .table thead th {
  background: #1e2940 !important;
  color: #8a97ad !important;
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .table tbody td {
  border-color: #222d47 !important;
  color: var(--lugina-text);
}
html[data-bs-theme="dark"] .table tbody td strong {
  color: var(--lugina-title);
}
html[data-bs-theme="dark"] .table-hover tbody tr:hover {
  background: #1e2940 !important;
}

/* ---------- FORM ---------- */
html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
  background: #1e2940 !important;
  border-color: #2a3654 !important;
  color: var(--lugina-title) !important;
}
html[data-bs-theme="dark"] .form-control::placeholder {
  color: var(--lugina-muted) !important;
}
html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
  border-color: var(--lugina-primary) !important;
  background: #222f4a !important;
  color: var(--lugina-title) !important;
}
html[data-bs-theme="dark"] .input-group-text {
  background: #1e2940 !important;
  border-color: #2a3654 !important;
  color: var(--lugina-muted) !important;
}

/* ---------- DROPDOWN ---------- */
html[data-bs-theme="dark"] .dropdown-menu {
  background: #1e2940 !important;
  border: 1px solid var(--lugina-border) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45) !important;
}
html[data-bs-theme="dark"] .dropdown-item {
  color: var(--lugina-text) !important;
}
html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus {
  background: #24314d !important;
  color: var(--lugina-title) !important;
}
html[data-bs-theme="dark"] .dropdown-divider {
  border-color: var(--lugina-border) !important;
}

/* ---------- BADGE (tetap soft tapi kontras di dark) ---------- */
html[data-bs-theme="dark"] .badge.bg-secondary {
  background: #243049 !important;
  color: #c3ccdb !important;
  border-color: #2f3e5f !important;
}

/* ---------- MODAL ---------- */
html[data-bs-theme="dark"] .modal-content {
  background: var(--lugina-card) !important;
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-footer {
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* ---------- ALERT ---------- */
html[data-bs-theme="dark"] .alert {
  border-color: var(--lugina-border);
}

/* ---------- CALENDAR DASHBOARD ---------- */
html[data-bs-theme="dark"] .dash-cal td {
  border-color: #243049 !important;
  background: #1a2236;
}
html[data-bs-theme="dark"] .dash-cal .cal-empty {
  background: transparent !important;
  border: none !important;
}
html[data-bs-theme="dark"] .dash-cal .cal-today {
  background: #1f2e4f !important;
}
html[data-bs-theme="dark"] .dash-cal-legend {
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .dash-upcoming-item {
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .dash-cal-nav a {
  border-color: var(--lugina-border) !important;
  color: var(--lugina-text) !important;
}

/* ---------- SCROLLBAR ---------- */
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #2a3654;
}
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #34446a;
}

/* ---------- SELECT2 DARK ---------- */
html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--single,
html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple {
  background: #1e2940 !important;
  border-color: #2a3654 !important;
  color: var(--lugina-title) !important;
}
html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection__rendered {
  color: var(--lugina-title) !important;
}
html[data-bs-theme="dark"] .select2-dropdown {
  background: #1e2940 !important;
  border-color: #2a3654 !important;
}
html[data-bs-theme="dark"] .select2-results__option {
  color: var(--lugina-text);
}
html[data-bs-theme="dark"] .select2-results__option--highlighted {
  background: var(--lugina-primary) !important;
  color: #fff !important;
}
html[data-bs-theme="dark"] .select2-search__field {
  background: #1a2236 !important;
  color: var(--lugina-title) !important;
  border-color: #2a3654 !important;
}

/* ---------- SUMMERNOTE DARK ---------- */
html[data-bs-theme="dark"] .note-editor.note-frame {
  background: #1e2940 !important;
  border-color: #2a3654 !important;
  color: var(--lugina-text) !important;
}
html[data-bs-theme="dark"] .note-toolbar {
  background: #1a2236 !important;
  border-color: #243049 !important;
}
html[data-bs-theme="dark"] .note-editable {
  background: #1e2940 !important;
  color: var(--lugina-text) !important;
}

/* ---------- LIST GROUP (settings) ---------- */
html[data-bs-theme="dark"] .list-group-item {
  background: transparent !important;
  color: var(--lugina-text) !important;
}
html[data-bs-theme="dark"] .list-group-item:hover {
  background: #1e2940 !important;
  color: var(--lugina-primary) !important;
}

/* ---------- FOOTER ---------- */
html[data-bs-theme="dark"] .footer {
  color: var(--lugina-muted) !important;
}

/* ---------- AUTH PAGE DARK: override gradient tetap terbaca ---------- */
html[data-bs-theme="dark"] body.auth-gradient {
  background:
    radial-gradient(
      1200px 600px at 15% -10%,
      rgba(255, 255, 255, 0.08) 0%,
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 95% 110%,
      rgba(255, 255, 255, 0.06) 0%,
      transparent 60%
    ),
    linear-gradient(135deg, #0b1a3a 0%, #1a1446 42%, #132b5a 72%, #0e2a4a 100%) !important;
}
html[data-bs-theme="dark"] .auth-page .card {
  background: #1a2236 !important;
  border-color: #243049 !important;
}

/* ---------- TRANSITION HALUS ---------- */
body,
.page,
.card,
.navbar,
.navbar-vertical,
.table,
.form-control,
.form-select,
.dropdown-menu,
.modal-content {
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

/* ---------- TOGGLE BUTTON ---------- */
.lugina-theme-toggle {
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}
.lugina-theme-toggle:active {
  transform: scale(0.95);
}

/* ==========================================================
   OVERRIDE TAMBAHAN: halaman public legacy (blacklist, automasi,
   segmentasi, logs, notifikasi, segmentasi_detail)
   ========================================================== */

/* bg-light hard-coded (automasi.php card-footer) */
html[data-bs-theme="dark"] .bg-light {
  background: #1e2940 !important;
  color: var(--lugina-text) !important;
  border-color: var(--lugina-border) !important;
}

/* notifikasi.php */
html[data-bs-theme="dark"] .notif-unread {
  background-color: rgba(15, 98, 254, 0.1) !important;
  border-left-color: var(--lugina-primary) !important;
}
html[data-bs-theme="dark"] .notif-read {
  border-left-color: transparent !important;
}
html[data-bs-theme="dark"] .notif-item:hover {
  background-color: #1e2940 !important;
}
html[data-bs-theme="dark"] .notif-card .nav-tabs .nav-link {
  color: var(--lugina-muted);
}
html[data-bs-theme="dark"] .notif-card .nav-tabs .nav-link.active {
  background: #1a2236;
  color: var(--lugina-title);
  border-color: var(--lugina-border) !important;
}

/* segmentasi_detail.php : bagian-tab */
html[data-bs-theme="dark"] .bagian-tab {
  border-color: var(--lugina-border) !important;
  background: #1e2940 !important;
  color: var(--lugina-text) !important;
}
html[data-bs-theme="dark"] .bagian-tab:hover {
  border-color: var(--lugina-primary) !important;
  background: #1e335a !important;
  color: #fff !important;
}
html[data-bs-theme="dark"] .bagian-tab.active {
  background: var(--lugina-primary) !important;
  border-color: var(--lugina-primary) !important;
  color: #fff !important;
}

/* blacklist/automasi/logs generic: .empty, breadcrumb, code */
html[data-bs-theme="dark"] .empty-title,
html[data-bs-theme="dark"] .empty-subtitle {
  color: var(--lugina-text) !important;
}
html[data-bs-theme="dark"] .breadcrumb-muted .breadcrumb-item a {
  color: var(--lugina-muted);
}
html[data-bs-theme="dark"] .breadcrumb-muted .breadcrumb-item.active {
  color: var(--lugina-title);
}
html[data-bs-theme="dark"] code {
  background: #1e2940;
  color: #8ec0ff;
  border-color: #243049;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

/* segmentasi.php : border rounded tiles & segment-card */
html[data-bs-theme="dark"] .segment-card {
  background: var(--lugina-card) !important;
  border-color: var(--lugina-border) !important;
}
html[data-bs-theme="dark"] .border.rounded {
  border-color: var(--lugina-border) !important;
  background: var(--lugina-card);
}

/* progress (automasi status antrian) */
html[data-bs-theme="dark"] .progress,
html[data-bs-theme="dark"] .auto-progress {
  background: #1e2940 !important;
}

/* search-box icon tetap muted dark */
html[data-bs-theme="dark"] .search-box i {
  color: var(--lugina-muted);
}

/* pagination dark */
html[data-bs-theme="dark"] .pagination .page-link {
  background: #1a2236;
  border-color: #243049;
  color: var(--lugina-text);
}
html[data-bs-theme="dark"] .pagination .page-item.active .page-link {
  /* background: var(--lugina-primary); */
  border-color: #ff5108;
  color: #ff5108;
}

html[data-bs-theme="dark"] .pagination .page-item:hover .page-link {
  background: #ff5108;
  border-color: #ff5108;
  color: #fdfcfc;
}

html[data-bs-theme="dark"] .page-item > a.page-link {
  color: #ff5108;
}

html[data-bs-theme="dark"] .pagination .page-item.disabled .page-link {
  background: #131a2b;
  color: #4a5672;
}

/* alert di segmentasi / notifikasi */
html[data-bs-theme="dark"] .alert-info {
  background: #142843 !important;
  border-color: #1e3a5f !important;
  color: #b9d4ff !important;
}
html[data-bs-theme="dark"] .alert-warning {
  background: #2e2614 !important;
  border-color: #4a3a12 !important;
  color: #ffde8a !important;
}

/* form-hint & small text contrast */
html[data-bs-theme="dark"] .form-hint,
html[data-bs-theme="dark"] .card-subtitle,
html[data-bs-theme="dark"] .page-subtitle {
  color: var(--lugina-muted) !important;
}

/* avatar bg-* -lt tetap terbaca di dark (Tabler pakai translucent) */
html[data-bs-theme="dark"] .bg-blue-lt,
html[data-bs-theme="dark"] .bg-green-lt,
html[data-bs-theme="dark"] .bg-red-lt,
html[data-bs-theme="dark"] .bg-yellow-lt,
html[data-bs-theme="dark"] .bg-purple-lt,
html[data-bs-theme="dark"] .bg-cyan-lt,
html[data-bs-theme="dark"] .bg-orange-lt,
html[data-bs-theme="dark"] .bg-secondary-lt {
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Button */

html[data-bs-theme="dark"] .navbar-vertical li.active > a.nav-link,
body.theme-dark .navbar-vertical li.active > a.nav-link,
[data-bs-theme="dark"] .navbar-vertical li.active > a.nav-link {
  background: #ff5108;
  color: #fff;
}

html[data-bs-theme="dark"] .nav-item.active .nav-link-icon {
  /* background: #77c708; */
  background: #ff5108;
  color: #fff;
}

/* Hover / active - light mode */
html[data-bs-theme="dark"] .navbar-vertical .navbar-nav > li > a.nav-link:hover,
html[data-bs-theme="dark"] .navbar-vertical .navbar-nav > li > a.nav-link:focus,
html[data-bs-theme="dark"] .navbar-vertical .dropdown-item:hover,
html[data-bs-theme="dark"] .navbar-vertical .dropdown-item:focus {
  background: #f6e1d8;
  color: #ff5108;
}

html[data-bs-theme="dark"] .navbar-vertical .nav-link-icon:hover {
  /* background: #77c708; */
  /* background: #ff5108;
  color: #fff; */
}

html[data-bs-theme="dark"]
  .navbar-vertical.navbar-expand-lg
  .navbar-collapse
  .dropdown-menu
  .dropdown-item.active,
html[data-bs-theme="dark"]
  .navbar-vertical.navbar-expand-lg
  .navbar-collapse
  .dropdown-menu
  .dropdown-item:active,
html[data-bs-theme="dark"]
  .navbar-vertical.navbar-expand-lg
  .navbar-collapse
  .dropdown-menu
  .dropdown-item:focus,
html[data-bs-theme="dark"]
  .navbar-vertical.navbar-expand-lg
  .navbar-collapse
  .dropdown-menu
  .dropdown-item:hover {
  background: #f6e1d8 !important;
  color: #ff5108 !important;
  /* font-weight: 700; */
}

html[data-bs-theme="dark"] .btn-primary {
  background: #ff5108;
  color: #fff;
  border-color: #ff5108;
}

html[data-bs-theme="dark"] .btn-primary:hover {
  background: #f6e1d8;
  color: #ff5108;
  border-color: #f6e1d8;
}

html[data-bs-theme="dark"] .btn-primary:focus {
  background: #ff5108;
  color: #fff;
  border-color: #ff5108;
}

/* html[data-bs-theme="dark"] .pagination .page-item.active .page-link {
  background: #ff5108;
  border-color: #ff5108;
  color: #fff;
} */

