:root,
[data-bs-theme=light] {
  --bs-primary: #dc3545;
  --bs-primary-rgb: 220, 53, 69;
  --bs-primary-text-emphasis: #58151C;
  --bs-primary-bg-subtle: #F7D6DA;
  --bs-primary-border-subtle: #EFAEB5;
  --bs-danger: #dc3545;
  --bs-danger-rgb: 220, 53, 69;
  --bs-danger-text-emphasis: #58151C;
  --bs-danger-bg-subtle: #F7D6DA;
  --bs-danger-border-subtle: #EFAEB5;

  /* Global Contrast Fixes */
  .text-dark {
    color: var(--bs-emphasis-color) !important;
  }

  .text-light {
    color: var(--bs-secondary-color) !important;
  }
}

[data-bs-theme=dark] {
  --bs-body-bg: #1a1b1f;
  --bs-body-color: #e4e6eb;
  --bs-tertiary-bg: #121316;
  --bs-primary: #dc3545;
  --bs-primary-rgb: 220, 53, 69;
  --bs-primary-text-emphasis: #DF828E;
  --bs-primary-bg-subtle: #28090D;
  --bs-primary-border-subtle: #791C28;
  --bs-danger: #dc3545;
  --bs-danger-rgb: 220, 53, 69;
  --bs-danger-text-emphasis: #DF828E;
  --bs-danger-bg-subtle: #28090D;
  --bs-danger-border-subtle: #791C28;

  /* Global Contrast Fixes */
  .text-dark {
    color: #e4e6eb !important;
  }

  .text-light {
    color: #ced4da !important;
  }

  .text-muted {
    color: #adb5bd !important;
  }

  .text-secondary {
    color: #adb5bd !important;
  }

  .opacity-75 {
    opacity: 0.85 !important;
  }

  /* Table and Card Overrides for Dark Mode */
  .table {
    --bs-table-color: #e4e6eb;
    --bs-table-border-color: #3e4147;
  }

  .table-hover tbody tr:hover {
    color: #fff;
    background-color: rgba(220, 53, 69, 0.1);
  }

  /* Modal Close Button Fix */
  .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.7;
  }

  .btn-close:hover {
    opacity: 1;
  }

  /* Table Contrast Fixes - Forced */
  .table td,
  .table th,
  .table tbody tr,
  .table-striped tbody tr:nth-of-type(odd) {
    color: #e4e6eb !important;
  }

  /* Form Labels in Dark Mode */
  .form-label,
  .modal-title,
  label {
    color: #e4e6eb !important;
  }
}

/* Nav Link Forced Clean White (Always) */
.navbar .nav-link,
.navbar .navbar-brand #fox_text,
.navbar .fa-circle-half-stroke,
.footer-basic,
.footer-basic .nav-link,
.footer-basic .copyright {
  color: #ffffff !important;
  transition: color 0.2s ease-in-out;
}

.navbar .nav-link:hover,
.navbar .nav-link.active,
.navbar .nav-link:focus,
.dropdown-item:hover,
.dropdown-item:focus {
  color: #ffc107 !important;
  /* Yellow Fox Kids */
}

/* Theme-aware Dropdowns */
.dropdown-menu {
  background-color: var(--bs-body-bg);
  border-color: #dc3545;
}

[data-bs-theme=light] .dropdown-item {
  color: #212529 !important;
}

[data-bs-theme=dark] .dropdown-item {
  color: #e4e6eb !important;
}

[data-bs-theme=dark] .dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Force Warning to Yellow (Eliminate Orange) */
.text-warning {
  color: #ffc107 !important;
}

.btn-warning,
.btn-outline-warning {
  --bs-btn-color: #000 !important;
  --bs-btn-bg: #ffc107 !important;
  --bs-btn-border-color: #ffc107 !important;
  --bs-btn-hover-bg: #eab106 !important;
  --bs-btn-hover-border-color: #eab106 !important;
}

/* Navbar Shrink Fixes (if using creative.js) */
.navbar.navbar-shrink .nav-link {
  color: #ffffff !important;
}

.navbar.navbar-shrink .nav-link:hover {
  color: #ffc107 !important;
}

/* FullCalendar Dark Mode Support */
[data-bs-theme=dark] .fc {
  --fc-button-text-color: #fff;
  --fc-button-bg-color: #2c2e33;
  --fc-button-border-color: #2c2e33;
  --fc-button-hover-bg-color: #3e4147;
  --fc-button-hover-border-color: #3e4147;
  --fc-button-active-bg-color: #dc3545;
  --fc-button-active-border-color: #dc3545;

  --fc-event-bg-color: #dc3545;
  --fc-event-border-color: #dc3545;
  --fc-event-text-color: #fff;

  --fc-page-bg-color: #1a1b1f;
  --fc-neutral-bg-color: #121316;
  --fc-neutral-text-color: #e4e6eb;
  --fc-border-color: #3e4147;

  --fc-today-bg-color: rgba(220, 53, 69, 0.1);
}

[data-bs-theme=dark] .fc-list-day-cushion,
[data-bs-theme=dark] .fc-list-event:hover td {
  background-color: #2c2e33;
}

[data-bs-theme=dark] .fc-col-header-cell-cushion,
[data-bs-theme=dark] .fc-timegrid-slot-label-cushion,
[data-bs-theme=dark] .fc-list-event-title a {
  color: #e4e6eb;
}

/* Scrollbar Customization */
[data-bs-theme=dark] *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-bs-theme=dark] *::-webkit-scrollbar-track {
  background: #121316;
}

[data-bs-theme=dark] *::-webkit-scrollbar-thumb {
  background: #3e4147;
  border-radius: 10px;
}

[data-bs-theme=dark] *::-webkit-scrollbar-thumb:hover {
  background: #dc3545;
}