:root {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

.header-nav .theme-toggle-item {
  display: flex;
  align-items: center;
}

.header-nav .theme-toggle-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  margin-right: 25px;
  line-height: 1;
}

.header-nav .theme-icon {
  font-size: 22px;
  color: #012970;
}

.header-nav .theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .header-nav .theme-icon {
  color: #d3deff;
}

:root[data-theme="dark"] .header-nav .theme-icon-sun {
  display: inline-block;
}

:root[data-theme="dark"] .header-nav .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(73, 160, 255, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(88, 119, 255, 0.14), transparent 30%),
    linear-gradient(180deg, #0f1727 0%, #101a2f 100%);
  color: #d8e1ff;
}

:root[data-theme="dark"] a {
  color: #8ea8ff;
}

:root[data-theme="dark"] a:hover {
  color: #b2c2ff;
}

:root[data-theme="dark"] .header,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .footer,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .dropdown-menu,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .list-group-item,
:root[data-theme="dark"] .offcanvas,
:root[data-theme="dark"] .toast {
  background-color: #1a243a;
  color: #d8e1ff;
  border-color: rgba(161, 176, 218, 0.24);
}

:root[data-theme="dark"] .footer {
  border-top-color: rgba(139, 166, 224, 0.2);
  background: rgba(15, 23, 42, 0.55);
}

:root[data-theme="dark"] .footer .copyright,
:root[data-theme="dark"] .footer .credits,
:root[data-theme="dark"] .footer .app-footer-links,
:root[data-theme="dark"] .footer .app-footer-links a {
  color: #a9bbdf;
}

:root[data-theme="dark"] .footer .app-footer-links a:hover,
:root[data-theme="dark"] .footer .app-footer-links a:focus,
:root[data-theme="dark"] .footer .credits a {
  color: #d6e3ff;
}

:root[data-theme="dark"] .header .toggle-sidebar-btn,
:root[data-theme="dark"] .header-nav .nav-icon,
:root[data-theme="dark"] .header-nav .nav-profile,
:root[data-theme="dark"] .logo span,
:root[data-theme="dark"] .pagetitle h1 {
  color: #d8e1ff;
}

:root[data-theme="dark"] .header-nav .profile {
  background: #1a243a;
  border: 1px solid rgba(161, 176, 218, 0.24);
}

:root[data-theme="dark"] .header-nav .profile .dropdown-header h6,
:root[data-theme="dark"] .header-nav .profile .dropdown-item,
:root[data-theme="dark"] .header-nav .profile .dropdown-item span,
:root[data-theme="dark"] .header-nav .profile .dropdown-item i {
  color: #e7efff;
}

:root[data-theme="dark"] .header-nav .profile .dropdown-header span,
:root[data-theme="dark"] .minimal-page-muted,
:root[data-theme="dark"] .text-muted,
:root[data-theme="dark"] .small,
:root[data-theme="dark"] .form-text {
  color: #a4b4d6 !important;
}

:root[data-theme="dark"] .header-nav .profile .dropdown-divider {
  border-top-color: rgba(161, 176, 218, 0.16);
}

:root[data-theme="dark"] .header-nav .profile .dropdown-item:hover,
:root[data-theme="dark"] .header-nav .profile .dropdown-item:focus {
  background: #24314c;
}

:root[data-theme="dark"] .minimal-page-card {
  background: rgba(26, 36, 58, 0.94);
  border-color: rgba(161, 176, 218, 0.24);
  box-shadow: 0 1rem 2.8rem rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .minimal-page-shell,
:root[data-theme="dark"] .minimal-page-shell h1,
:root[data-theme="dark"] .minimal-page-shell h2,
:root[data-theme="dark"] .minimal-page-shell h3,
:root[data-theme="dark"] .minimal-page-shell h4,
:root[data-theme="dark"] .minimal-page-shell h5,
:root[data-theme="dark"] .minimal-page-shell .card-title,
:root[data-theme="dark"] .minimal-page-shell label,
:root[data-theme="dark"] .minimal-page-shell strong,
:root[data-theme="dark"] .legal-doc-content {
  color: #e7efff;
}

:root[data-theme="dark"] .minimal-page-shell .form-control,
:root[data-theme="dark"] .minimal-page-shell .form-check-input,
:root[data-theme="dark"] .otp-input {
  background-color: #111b30;
  border-color: rgba(161, 176, 218, 0.24);
  color: #e7efff;
}

:root[data-theme="dark"] .minimal-page-shell .form-control::placeholder {
  color: #7f91b8;
}

:root[data-theme="dark"] .legal-doc-frame {
  background: rgba(17, 27, 48, 0.92);
  border-color: rgba(161, 176, 218, 0.2);
}

:root[data-theme="dark"] .password-criteria li {
  color: #ff928f;
}

:root[data-theme="dark"] .password-criteria li.valid {
  color: #73d7a0;
}

:root[data-theme="dark"] .header,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .footer {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .sidebar-nav .nav-link {
  background: #24314c;
  color: #a8b9eb;
}

:root[data-theme="dark"] .sidebar-nav .nav-link i,
:root[data-theme="dark"] .sidebar-nav .nav-content a i {
  color: #8ea8ff;
}

:root[data-theme="dark"] .sidebar-nav .nav-link.collapsed {
  background: transparent;
  color: #d8e1ff;
}

:root[data-theme="dark"] .sidebar-nav .nav-link:hover,
:root[data-theme="dark"] .sidebar-nav .nav-content a:hover {
  background: #24314c;
  color: #d8e1ff;
}

:root[data-theme="dark"] .sidebar-nav .nav-content a {
  color: #b5c5ef;
}

:root[data-theme="dark"] .sidebar-nav .nav-heading,
:root[data-theme="dark"] .text-muted,
:root[data-theme="dark"] .dropdown-menu .dropdown-header span,
:root[data-theme="dark"] .table > :not(caption) > * > * {
  color: #9aaad4 !important;
}

:root[data-theme="dark"] .dropdown-menu .dropdown-footer a,
:root[data-theme="dark"] .header-nav .profile .dropdown-item {
  color: #d8e1ff;
}

:root[data-theme="dark"] .dropdown-menu-arrow::before {
  background: #1a243a;
  border-top-color: rgba(161, 176, 218, 0.24);
  border-left-color: rgba(161, 176, 218, 0.24);
}

:root[data-theme="dark"] .header-nav .notifications .notification-item:hover,
:root[data-theme="dark"] .header-nav .messages .message-item:hover,
:root[data-theme="dark"] .header-nav .profile .dropdown-item:hover,
:root[data-theme="dark"] .dropdown-menu .dropdown-item:hover {
  background-color: #24314c;
}

:root[data-theme="dark"] .header-nav .notifications .notification-item-link {
  color: #d8e1ff;
}

:root[data-theme="dark"] .table,
:root[data-theme="dark"] .table > :not(caption) > * > * {
  color: #d8e1ff;
  border-color: rgba(161, 176, 218, 0.2);
}

:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] .form-check-input,
:root[data-theme="dark"] .input-group-text {
  background-color: #1d2841;
  border-color: rgba(161, 176, 218, 0.28);
  color: #d8e1ff;
}

:root[data-theme="dark"] .form-control:focus,
:root[data-theme="dark"] .form-select:focus {
  background-color: #1d2841;
  color: #eef2ff;
  border-color: #8ea8ff;
  box-shadow: 0 0 0 0.2rem rgba(142, 168, 255, 0.25);
}

:root[data-theme="dark"] .form-control::placeholder {
  color: #9aaad4;
}

:root[data-theme="dark"] .otp-input,
:root[data-theme="dark"] .code-inputs input {
  background-color: #1d2841;
  border-color: rgba(161, 176, 218, 0.28);
  color: #d8e1ff;
}

:root[data-theme="dark"] .password-criteria li {
  color: #ff8d9b;
}

:root[data-theme="dark"] .password-criteria li.valid {
  color: #5ed28f;
}

:root[data-theme="dark"] .header .search-form input {
  background: #1d2841;
  color: #d8e1ff;
  border-color: rgba(161, 176, 218, 0.28);
}

:root[data-theme="dark"] .header .search-form button i {
  color: #d8e1ff;
}

:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .modal-footer,
:root[data-theme="dark"] .card-header,
:root[data-theme="dark"] .card-footer {
  border-color: rgba(161, 176, 218, 0.2);
}

:root[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

:root[data-theme="dark"] .back-to-top {
  background: #5f7eff;
}

:root[data-theme="dark"] .back-to-top:hover {
  background: #7991ff;
}

:root[data-theme="dark"] .app-page-hero {
  background: linear-gradient(125deg, #233867 0%, #2e5cb3 55%, #3d7ef0 100%) !important;
}

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

:root[data-theme="dark"] .card-title,
:root[data-theme="dark"] .card-title * {
  color: #d8e1ff;
}

:root[data-theme="dark"] .accordion-item {
  background: #1a243a;
  border-color: rgba(161, 176, 218, 0.24);
}

:root[data-theme="dark"] .accordion-button {
  background: #1a243a;
  color: #d8e1ff;
}

:root[data-theme="dark"] .accordion-button:not(.collapsed) {
  background: #24314c;
  color: #e5ecff;
}

:root[data-theme="dark"] .accordion-button::after {
  filter: invert(1) saturate(0) brightness(1.8);
}

:root[data-theme="dark"] .accordion-body {
  background: #1a243a;
  color: #c8d5f6;
}

:root[data-theme="dark"] .section.section-header.text-dark,
:root[data-theme="dark"] .section.section-header .lead,
:root[data-theme="dark"] #faq .lead,
:root[data-theme="dark"] #about p,
:root[data-theme="dark"] #download p {
  color: #d8e1ff !important;
}

:root[data-theme="dark"] .section.section-lg .card.bg-white,
:root[data-theme="dark"] .section.section-lg .card .card-header.bg-white {
  background: #1a243a !important;
  border-color: rgba(161, 176, 218, 0.24) !important;
}

:root[data-theme="dark"] .section.section-lg .card.bg-white p,
:root[data-theme="dark"] .section.section-lg .card.bg-white h2,
:root[data-theme="dark"] .section.section-lg .card.bg-white .text-dark {
  color: #d8e1ff !important;
}

:root[data-theme="dark"] .up-shell .up-panel,
:root[data-theme="dark"] .lp-shell .lp-panel,
:root[data-theme="dark"] .ae-shell .ae-panel,
:root[data-theme="dark"] .courses-shell .courses-panel,
:root[data-theme="dark"] .courses-shell .course-row-card,
:root[data-theme="dark"] .admin-dashboard-shell .admin-section-card {
  background: #1a243a !important;
  border-color: rgba(161, 176, 218, 0.24) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.32) !important;
}

:root[data-theme="dark"] .up-shell .up-stat,
:root[data-theme="dark"] .lp-shell .lp-stat,
:root[data-theme="dark"] .ae-shell .ae-empty,
:root[data-theme="dark"] .lp-shell .lp-empty,
:root[data-theme="dark"] .up-shell .up-empty,
:root[data-theme="dark"] .courses-shell .courses-empty {
  background: rgba(142, 168, 255, 0.12) !important;
  border-color: rgba(161, 176, 218, 0.28) !important;
  color: #b8c8ef !important;
}

:root[data-theme="dark"] .up-shell .up-meta-key,
:root[data-theme="dark"] .lp-shell .lp-meta-key,
:root[data-theme="dark"] .courses-shell .course-meta-label,
:root[data-theme="dark"] .admin-dashboard-shell .text-muted,
:root[data-theme="dark"] .ae-shell .text-muted,
:root[data-theme="dark"] .lp-shell .text-muted,
:root[data-theme="dark"] .up-shell .text-muted,
:root[data-theme="dark"] .courses-shell .text-muted {
  color: #9aaad4 !important;
}

:root[data-theme="dark"] .up-shell .up-meta-val,
:root[data-theme="dark"] .lp-shell .lp-meta-val,
:root[data-theme="dark"] .courses-shell .course-meta-value,
:root[data-theme="dark"] .admin-dashboard-shell h2,
:root[data-theme="dark"] .admin-dashboard-shell h5,
:root[data-theme="dark"] .admin-dashboard-shell p,
:root[data-theme="dark"] .ae-shell h3,
:root[data-theme="dark"] .lp-shell h3,
:root[data-theme="dark"] .up-shell h3,
:root[data-theme="dark"] .ae-shell h4,
:root[data-theme="dark"] .lp-shell h4,
:root[data-theme="dark"] .up-shell h4 {
  color: #d8e1ff;
}

:root[data-theme="dark"] .up-shell .up-meta-row,
:root[data-theme="dark"] .lp-shell .lp-meta-row,
:root[data-theme="dark"] .table > :not(caption) > * > * {
  border-color: rgba(161, 176, 218, 0.2);
}

:root[data-theme="dark"] .courses-shell .subject-accordion .accordion-button:not(.collapsed) {
  background: rgba(142, 168, 255, 0.16);
  color: #e5ecff;
}

:root[data-theme="dark"] .admin-dashboard-shell .text-primary,
:root[data-theme="dark"] .admin-dashboard-shell .display-5 i {
  color: #9bb3ff !important;
}

:root[data-theme="dark"] {
  --app-border: rgba(161, 176, 218, 0.26);
  --app-text-muted: #9aaad4;
  --app-card-bg: #1a243a;
  --app-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
  --app-input-border: rgba(161, 176, 218, 0.28);
  --app-accent-soft: rgba(142, 168, 255, 0.15);
  --app-muted-panel-bg: rgba(142, 168, 255, 0.12);
  --app-muted-panel-text: #a8b9eb;
}
