/* ============================================================
   DARK MODE OVERRIDES
   Styles applied when [data-bs-theme="dark"] is active
   ============================================================ */

/* ── Global Dark Overrides ──*/
[data-bs-theme="dark"] {
  color-scheme: dark;

  /* ── Semantic Color Overrides for Dark Mode ──
     Bootstrap's default palette (#198754, #dc3545, #ffc107) is designed
     for light backgrounds. In dark mode, we shift to brighter, more vivid
     values so they remain legible and visually strong on dark surfaces.
  ── */

  /* Success: Brighter emerald green */
  --bs-success:            #22c55e;
  --bs-success-rgb:        34, 197, 94;
  --bs-success-text-emphasis: #4ade80;
  --bs-success-bg-subtle:  rgba(34, 197, 94, 0.15);
  --bs-success-border-subtle: rgba(34, 197, 94, 0.25);

  /* Danger: Bright coral red */
  --bs-danger:             #f87171;
  --bs-danger-rgb:         248, 113, 113;
  --bs-danger-text-emphasis: #fca5a5;
  --bs-danger-bg-subtle:   rgba(248, 113, 113, 0.15);
  --bs-danger-border-subtle: rgba(248, 113, 113, 0.25);

  /* Warning: Vivid amber */
  --bs-warning:            #fbbf24;
  --bs-warning-rgb:        251, 191, 36;
  --bs-warning-text-emphasis: #fcd34d;
  --bs-warning-bg-subtle:  rgba(251, 191, 36, 0.15);
  --bs-warning-border-subtle: rgba(251, 191, 36, 0.25);

  /* Info: Bright sky blue */
  --bs-info:               #38bdf8;
  --bs-info-rgb:           56, 189, 248;
  --bs-info-text-emphasis: #7dd3fc;
  --bs-info-bg-subtle:     rgba(56, 189, 248, 0.15);
  --bs-info-border-subtle: rgba(56, 189, 248, 0.25);
}

/* ── Text colors in dark mode ── */
[data-bs-theme="dark"] .text-success { color: #4ade80 !important; }
[data-bs-theme="dark"] .text-danger  { color: #fca5a5 !important; }
[data-bs-theme="dark"] .text-warning { color: #fcd34d !important; }
[data-bs-theme="dark"] .text-info    { color: #7dd3fc !important; }
[data-bs-theme="dark"] .text-primary { color: #93c5fd !important; }

/* ── Badge backgrounds in dark mode ── */
[data-bs-theme="dark"] .badge.bg-success,
[data-bs-theme="dark"] .badge.text-bg-success { background-color: #16a34a !important; color: #f0fdf4 !important; }

[data-bs-theme="dark"] .badge.bg-danger,
[data-bs-theme="dark"] .badge.text-bg-danger  { background-color: #dc2626 !important; color: #fff1f2 !important; }

[data-bs-theme="dark"] .badge.bg-warning,
[data-bs-theme="dark"] .badge.text-bg-warning { background-color: #d97706 !important; color: #fffbeb !important; }

[data-bs-theme="dark"] .badge.bg-info,
[data-bs-theme="dark"] .badge.text-bg-info    { background-color: #0284c7 !important; color: #f0f9ff !important; }

/* ── Subtle/ghost badges (bg-opacity-10) in dark mode ── */
[data-bs-theme="dark"] .badge.bg-success.bg-opacity-10 { background-color: rgba(34, 197, 94, 0.18) !important; color: #4ade80 !important; }
[data-bs-theme="dark"] .badge.bg-danger.bg-opacity-10  { background-color: rgba(248, 113, 113, 0.18) !important; color: #fca5a5 !important; }
[data-bs-theme="dark"] .badge.bg-warning.bg-opacity-10 { background-color: rgba(251, 191, 36, 0.18) !important; color: #fcd34d !important; }
[data-bs-theme="dark"] .badge.bg-info.bg-opacity-10    { background-color: rgba(56, 189, 248, 0.18) !important; color: #7dd3fc !important; }

/* ── Background subtle (bg-opacity-10 used in table cells, cards, etc.) ── */
[data-bs-theme="dark"] .bg-success.bg-opacity-10 { background-color: rgba(34, 197, 94, 0.12) !important; }
[data-bs-theme="dark"] .bg-danger.bg-opacity-10  { background-color: rgba(248, 113, 113, 0.12) !important; }
[data-bs-theme="dark"] .bg-warning.bg-opacity-10 { background-color: rgba(251, 191, 36, 0.12) !important; }
[data-bs-theme="dark"] .bg-info.bg-opacity-10    { background-color: rgba(56, 189, 248, 0.12) !important; }
[data-bs-theme="dark"] .bg-primary.bg-opacity-10 { background-color: rgba(96, 165, 250, 0.15) !important; }

/* ── Border colors in dark mode ── */
[data-bs-theme="dark"] .border-success { border-color: rgba(34, 197, 94, 0.40) !important; }
[data-bs-theme="dark"] .border-danger  { border-color: rgba(248, 113, 113, 0.40) !important; }
[data-bs-theme="dark"] .border-warning { border-color: rgba(251, 191, 36, 0.40) !important; }
[data-bs-theme="dark"] .border-info    { border-color: rgba(56, 189, 248, 0.40) !important; }

/* ── btn-outline-* in dark mode ── */
[data-bs-theme="dark"] .btn-outline-primary { color: #93c5fd !important; border-color: #93c5fd !important; }
[data-bs-theme="dark"] .btn-outline-primary:hover { background-color: rgba(96, 165, 250, 0.15) !important; color: #bfdbfe !important; }
[data-bs-theme="dark"] .btn-outline-success { color: #4ade80 !important; border-color: #4ade80 !important; }
[data-bs-theme="dark"] .btn-outline-success:hover { background-color: rgba(34, 197, 94, 0.15) !important; }
[data-bs-theme="dark"] .btn-outline-danger  { color: #fca5a5 !important; border-color: #fca5a5 !important; }
[data-bs-theme="dark"] .btn-outline-danger:hover  { background-color: rgba(248, 113, 113, 0.15) !important; }
[data-bs-theme="dark"] .btn-outline-warning { color: #fcd34d !important; border-color: #fcd34d !important; }
[data-bs-theme="dark"] .btn-outline-warning:hover { background-color: rgba(251, 191, 36, 0.15) !important; }
[data-bs-theme="dark"] .btn-outline-info    { color: #7dd3fc !important; border-color: #7dd3fc !important; }
[data-bs-theme="dark"] .btn-outline-info:hover    { background-color: rgba(56, 189, 248, 0.15) !important; }

[data-bs-theme="dark"] body {
  background-color: #121212 !important;
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .app-wrapper,
[data-bs-theme="dark"] .app-main,
[data-bs-theme="dark"] .app-content {
  background-color: #121212 !important;
}

[data-bs-theme="dark"] .card {
  background-color: #1e1e1e !important;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8f9fa !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .modal-content {
  background-color: #24292e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background-color: #2a3036 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}

/* Fix: Restore contextual colors for input-group-text in Dark Mode that were overridden by the rule above */
[data-bs-theme="dark"] .input-group-text.bg-primary { background-color: var(--bs-primary) !important; color: #fff !important; }
[data-bs-theme="dark"] .input-group-text.bg-secondary { background-color: var(--bs-secondary) !important; color: #fff !important; }
[data-bs-theme="dark"] .input-group-text.bg-success { background-color: var(--bs-success) !important; color: #fff !important; }
[data-bs-theme="dark"] .input-group-text.bg-danger { background-color: var(--bs-danger) !important; color: #fff !important; }
[data-bs-theme="dark"] .input-group-text.bg-warning { background-color: var(--bs-warning) !important; color: #121212 !important; }
[data-bs-theme="dark"] .input-group-text.bg-info { background-color: var(--bs-info) !important; color: #fff !important; }
[data-bs-theme="dark"] .input-group-text.bg-dark { background-color: var(--bs-dark) !important; color: #fff !important; }
[data-bs-theme="dark"] .input-group-text.bg-transparent { background-color: transparent !important; border-color: rgba(255, 255, 255, 0.15) !important; }

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #343a40 !important;
  border-color: var(--vm-accent) !important;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
  color: #fff !important;
}

/* ── Tables in Dark Mode ── */
[data-bs-theme="dark"] .table {
  color: #f8f9fa !important;
}
[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
  border-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .thead-themed th,
[data-bs-theme="dark"] .thead-themed {
  background-color: #2a3036 !important;
  color: #e2e8f0 !important;
  border-bottom: 2px solid #4a5568 !important;
}
[data-bs-theme="dark"] .table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)));
  background-color: rgba(255, 255, 255, 0.02) !important;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
  color: #fff !important;
}

/* ── UI Components in Dark Mode ── */
[data-bs-theme="dark"] .navbar {
  background-color: #1a1d20 !important;
  border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: #24292e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .dropdown-item {
  color: #ced4da !important;
}

[data-bs-theme="dark"] .dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .bg-white {
  background-color: #1e1e1e !important;
}

[data-bs-theme="dark"] .bg-light {
  background-color: #2a3036 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .text-muted {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] .btn-light {
  background-color: #2a3036 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .btn-light:hover {
  background-color: #343a40 !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
  color: #adb5bd !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

/* ── Custom Modules Dark Mode ── */
[data-bs-theme="dark"] .info-box {
  background-color: #1e1e1e !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .pos-search-box {
  background-color: #2a3036 !important;
}

[data-bs-theme="dark"] .skeleton-box {
  background-color: rgba(0, 0, 0, 0.2) !important;
}

[data-bs-theme="dark"] .user-initials-badge {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
}

[data-bs-theme="dark"] .demo-banner {
  background: linear-gradient(90deg, #92400e 0%, #78350f 100%);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .demo-cred code {
  background: rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .swal2-popup {
  background-color: #24292e !important;
  color: #f8f9fa !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6) !important;
  border-radius: var(--vm-radius-lg) !important;
}

[data-bs-theme="dark"] .swal2-title,
[data-bs-theme="dark"] .swal2-html-container {
  color: #f8f9fa !important;
}

/* ============================================================
   DARK MODE PREMIUM ELEVATIONS v2
   Deeper shadows, color glows, glass table headers.
   ============================================================ */

/* ── Deep card elevation in dark (all .card.shadow-sm) ── */
[data-bs-theme="dark"] .card.shadow-sm {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.50), 0 1px 6px rgba(0, 0, 0, 0.35) !important;
}

/* ── Metric cards: stronger color glows in dark ── */
[data-bs-theme="dark"] .custom-bg-dark-adapt.border-info:hover    { box-shadow: 0 20px 52px rgba(13, 202, 240, 0.28) !important; }
[data-bs-theme="dark"] .custom-bg-dark-adapt.border-success:hover { box-shadow: 0 20px 52px rgba(25, 135, 84, 0.28) !important; }
[data-bs-theme="dark"] .custom-bg-dark-adapt.border-warning:hover { box-shadow: 0 20px 52px rgba(255, 193, 7, 0.28) !important; }
[data-bs-theme="dark"] .custom-bg-dark-adapt.border-primary:hover { box-shadow: 0 20px 52px rgba(99, 102, 241, 0.28) !important; }
[data-bs-theme="dark"] .custom-bg-dark-adapt.border-danger:hover  { box-shadow: 0 20px 52px rgba(220, 53, 69, 0.28) !important; }

/* ── Mini-cards in dark: richer glass surface ── */
[data-bs-theme="dark"] .saas-mini-card {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.40) !important;
}
[data-bs-theme="dark"] .saas-mini-card:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.20) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.50) !important;
}

/* ── Donut/Chart canvases — deeper shadow in dark ── */
[data-bs-theme="dark"] .chart-container-sm canvas {
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.55));
}
[data-bs-theme="dark"] .chart-container-sm:hover canvas {
  filter: drop-shadow(0 6px 26px rgba(0, 0, 0, 0.70));
}

/* ── Table thead — glass gradient in dark ── */
[data-bs-theme="dark"] .thead-themed,
[data-bs-theme="dark"] .thead-themed th {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.04) 100%
  ) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.85) !important;
  letter-spacing: 0.9px;
}

/* ── Table row hover in dark — accent glow ── */
[data-bs-theme="dark"] .table-responsive .table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.08) !important;
  box-shadow: inset 3px 0 0 0 var(--vm-accent) !important;
}

/* ── Metric cards in dark — card background slightly elevated ── */
[data-bs-theme="dark"] .custom-bg-dark-adapt.border-top.border-4 {
  background-color: #252535 !important;
}

/* ── Daterangepicker Dark Mode Fix ── */
[data-bs-theme="dark"] .daterangepicker {
  background-color: #24292e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #f8f9fa !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}

[data-bs-theme="dark"] .daterangepicker:before,
[data-bs-theme="dark"] .daterangepicker:after {
  display: none !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table {
  background-color: transparent !important;
  border: none !important;
}

[data-bs-theme="dark"] .daterangepicker .calendar-table table {
  background-color: transparent !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges {
  background-color: #1e1e1e !important;
  border-radius: var(--bs-border-radius);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .daterangepicker .ranges li {
  color: #ced4da !important;
  background-color: transparent !important;
  border-radius: 4px;
  margin-bottom: 2px;
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .daterangepicker .ranges li:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .daterangepicker .ranges li.active {
  background-color: var(--bs-primary) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .daterangepicker td.off, 
[data-bs-theme="dark"] .daterangepicker td.off.end-date, 
[data-bs-theme="dark"] .daterangepicker td.off.in-range, 
[data-bs-theme="dark"] .daterangepicker td.off.start-date {
  background-color: transparent !important;
  color: rgba(255, 255, 255, 0.2) !important;
}

[data-bs-theme="dark"] .daterangepicker td.in-range {
  background-color: rgba(13, 110, 253, 0.2) !important;
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .daterangepicker td.active, 
[data-bs-theme="dark"] .daterangepicker td.active:hover {
  background-color: var(--bs-primary) !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .daterangepicker td.available:hover, 
[data-bs-theme="dark"] .daterangepicker th.available:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .daterangepicker select.monthselect, 
[data-bs-theme="dark"] .daterangepicker select.yearselect {
  background-color: #2a3036 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}
