/* ------------------------------
       Theme variables & general reset
       ------------------------------ */
:root {
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --primary-light: #3d8bfd;
  --secondary: #f8fafc;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
  --dark: #212529;
  --light: #f8f9fa;
  --gray: #6c757d;
  --gray-light: #f8f9fa;
  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --header-height: 70px;
  --radius: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --glass: rgba(255, 255, 255, 0.95);
  --transition: all 0.2s ease;

  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --glass-border: rgba(0, 0, 0, 0.06);
  --text: #212529;
  --muted: #6c757d;
  --accent-neon: #6f42c1;
}

body[data-theme="dark"] {
  --primary: #3d8bfd;
  --primary-dark: #0d6efd;
  --primary-light: #6ea8fe;
  --secondary: #212529;
  --success: #75b798;
  --warning: #ffda6a;
  --danger: #ea868f;
  --info: #6edff6;
  --dark: #f8f9fa;
  --light: #212529; /* Block Background */
  --gray: #adb5bd;
  --gray-light: #343a40;
  --glass: rgba(33, 37, 41, 0.95);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);

  --bg: #121212;
  --surface: #1e1e1e;
  --surface-2: #2d2d2d;
  --glass-border: rgba(255, 255, 255, 0.08);
  --text: #f8f9fa;
  --muted: #adb5bd;
  --accent-neon: #b388ff;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial;
  background: var(--bg);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background 0.4s ease,
    color 0.4s ease;
  line-height: 1.6;
  min-height: 100vh;
}

/* ------------------------------
       Layout: Sidebar + Main content
       ------------------------------ */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  padding: 18px 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-3d);
  z-index: 1100;
  transition: all var(--transition-speed) ease;
  border-radius: 0 var(--radius) var(--radius) 0;
}

body[data-theme="dark"] .sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--glass);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header .brand-title,
.sidebar.collapsed .user-profile .user-details,
.sidebar.collapsed .nav-link span {
  opacity: 0;
  visibility: hidden;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sidebar.collapsed .user-profile {
  justify-content: center;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.sidebar.collapsed .nav-link i {
  margin-right: 0;
}

.sidebar.collapsed .nav-submenu {
  display: none !important;
}

.sidebar.collapsed .nav-submenu-link .bi-chevron-down {
  display: none !important;
}

/* Neon vertical accent */
.sidebar .sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 20px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
}

body[data-theme="dark"] .sidebar .sidebar-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--primary), var(--accent-neon));
  box-shadow: var(--neon-glow);
  transform: translateZ(0);
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--dark);
  letter-spacing: 0.2px;
  transition: opacity var(--transition-speed) ease;
  white-space: nowrap;
}

.sidebar .user-profile {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin: 14px 20px 22px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-speed) ease;
}

body[data-theme="dark"] .sidebar .user-profile {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.user-profile img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--glass-border);
  flex-shrink: 0;
}

.user-details {
  transition: opacity var(--transition-speed) ease;
  overflow: hidden;
}

.user-name {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-list {
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  margin: 4px 10px;
  border-radius: 10px;
  color: var(--dark);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.24s ease;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-link span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.nav-link i {
  font-size: 1.05rem;
  width: 24px;
  text-align: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  box-shadow: var(--neon-glow);
}

body[data-theme="dark"] .nav-link:hover,
body[data-theme="dark"] .nav-link.active {
  background: rgba(59, 130, 246, 0.15);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: linear-gradient(to bottom, var(--primary), var(--accent-neon));
  border-radius: 0 4px 4px 0;
}

/* Nested Submenus */
.nav-submenu {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.nav-submenu .nav-link {
  padding: 8px 10px 8px 45px;
  margin: 2px 10px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--gray);
}

body[data-theme="dark"] .nav-submenu .nav-link {
  color: var(--muted);
}

.nav-submenu .nav-link:hover,
.nav-submenu .nav-link.active {
  color: var(--primary);
}

.nav-submenu-link .bi-chevron-down {
  transition: transform 0.3s ease;
}

.nav-submenu-link[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(-180deg);
}

/* Sidebar bottom */
.sidebar .sidebar-footer {
  margin: 22px 20px 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
}

body[data-theme="dark"] .sidebar .sidebar-footer {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Collapsed sidebar on small screens */
.sidebar.closed {
  transform: translateX(-100%);
}

/* Main content area */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 0;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
  transition:
    margin-left var(--transition-speed) ease,
    width var(--transition-speed) ease;
  min-height: 100vh;
}

.main-content > .content-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--glass-border);
}

.main-content > .content {
  padding: 28px;
  flex: 1 1 auto;
}

.main-content > footer {
  padding: 16px 28px;
  margin-top: auto;
}

.main-content.expanded {
  margin-left: var(--sidebar-collapsed);
  width: calc(100% - var(--sidebar-collapsed));
}

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 1100;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 16px;
  }
}

/* ------------------------------
       Top header
       ------------------------------ */
/* Enhanced Header Styles */
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.header-content {
  min-width: 0; /* Prevents flex item overflow */
}

.header-title-section {
  min-width: 280px;
  flex-shrink: 0;
}

.header-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.2;
  margin: 0;
}

.header-actions {
  flex-shrink: 0;
}

/* Enhanced Search Bar */
.search-container {
  position: relative;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  min-width: 280px;
  box-shadow: var(--glass-shadow);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: var(--neon-glow);
}

.search-bar i {
  color: var(--gray);
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.search-bar input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--dark);
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}

.search-bar input::placeholder {
  color: var(--gray);
}

.search-shortcut {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--gray);
  flex-shrink: 0;
}

/* Enhanced Buttons */
.btn-glass,
.btn-primary-glass {
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  position: relative;
  overflow: hidden;
}

.btn-glass {
  background: var(--surface);
  color: var(--dark);
}

.btn-glass:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
  box-shadow: var(--neon-glow);
}

.btn-primary-glass {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  box-shadow: var(--neon-glow);
}

.btn-primary-glass:hover {
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

/* Enhanced Dropdowns */
.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-3d);
  backdrop-filter: var(--glass-blur);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--dark);
  transition: all 0.2s ease;
  margin: 0.125rem 0;
}

.dropdown-item:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

/* Theme Toggle Enhancement */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--dark);
}

.theme-toggle:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
  transform: rotate(15deg);
}

.theme-toggle-mobile {
  display: flex;
  align-items: center;
  color: var(--dark);
  cursor: pointer;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .content-header {
    gap: 1rem;
  }

  .header-title-section {
    min-width: 240px;
  }

  .search-bar {
    min-width: 250px;
  }
}

@media (max-width: 992px) {
  .content-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions > .d-flex {
    justify-content: space-between;
  }

  .search-container {
    max-width: 100%;
  }

  .search-bar {
    min-width: 100%;
  }
}

@media (max-width: 768px) {
  .content-header {
    padding: 0.75rem 0;
  }

  .header-title-section {
    min-width: 100%;
    text-align: center;
  }

  .header-actions > .d-flex {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 0.5rem;
  }

  .header-actions > .d-flex::-webkit-scrollbar {
    display: none;
  }

  .btn-glass,
  .btn-primary-glass {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
  }

  .search-bar {
    padding: 0.625rem 0.875rem;
  }

  .dropdown-menu {
    min-width: 200px;
  }
}

@media (max-width: 576px) {
  .content-header {
    gap: 0.75rem;
  }

  .header-title {
    font-size: 1.375rem;
  }

  .header-actions > .d-flex {
    gap: 0.375rem;
  }

  .btn-glass,
  .btn-primary-glass {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 10px;
  }

  .btn-glass .bi,
  .btn-primary-glass .bi {
    margin-right: 0.25rem;
  }

  .search-bar {
    padding: 0.5rem 0.75rem;
    min-width: 100%;
  }

  .search-bar input {
    font-size: 0.875rem;
  }

  .search-bar input::placeholder {
    font-size: 0.8rem;
  }

  .theme-toggle {
    padding: 0.5rem;
  }
}

@media (max-width: 380px) {
  .header-actions > .d-flex {
    flex-direction: column;
    gap: 0.5rem;
  }

  .header-actions > .d-flex > * {
    width: 100%;
    justify-content: center;
  }

  .btn-glass,
  .btn-primary-glass {
    justify-content: center;
  }
}

/* Dark mode adjustments */
body[data-theme="dark"] .search-bar {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

body[data-theme="dark"] .dropdown-menu {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .dropdown-item {
  color: var(--text);
}

body[data-theme="dark"] .dropdown-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

body[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Loading states */
.btn-glass.loading,
.btn-primary-glass.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-glass.loading::after,
.btn-primary-glass.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  right: 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Focus states for accessibility */
.search-bar input:focus,
.btn-glass:focus,
.btn-primary-glass:focus,
.dropdown-toggle:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .search-bar,
  .btn-glass,
  .btn-primary-glass,
  .theme-toggle,
  .dropdown-item {
    transition: none;
  }

  .btn-glass:hover,
  .btn-primary-glass:hover {
    transform: none;
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--surface);
  cursor: pointer;
  box-shadow: var(--glass-shadow);
  transition: all 0.2s ease;
  position: relative;
  color: var(--dark);
}

body[data-theme="dark"] .icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.icon-btn:hover {
  box-shadow: var(--neon-glow);
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

/* ------------------------------
       Dashboard cards grid
       ------------------------------ */
.stats-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 24px;
}

.glass-card {
  background: var(--surface);
  border-radius: var(--radius);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  overflow: hidden;
}

body[data-theme="dark"] .glass-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-card:hover {
  box-shadow: var(--neon-glow);
}

.stat-card {
  padding: var(--card-padding);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.stat-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--neon-glow);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 8px 0 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-title {
  color: var(--gray);
  font-size: 0.92rem;
  margin: 0;
  font-weight: 600;
}

.stat-trend {
  display: flex;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  color: var(--success);
  font-weight: 600;
}

.trend-up {
  color: var(--success);
}

.trend-down {
  color: var(--danger);
}

.badge-glass {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.8rem;
}

/* make responsive */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .search-bar {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Big panels (charts / tables) */
.panel {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  height: 100%;
}

body[data-theme="dark"] .panel {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark);
}

/* Buttons */
.btn-glass {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-glass:hover {
  background: rgba(37, 99, 235, 0.2);
  box-shadow: var(--neon-glow);
}

.btn-primary-glass {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--neon-glow);
  transition: all 0.2s ease;
}

.btn-primary-glass:hover {
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

/* Activity list */
.activity {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  transition: all 0.2s ease;
}

body[data-theme="dark"] .activity-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.activity-item:hover {
  box-shadow: var(--glass-shadow);
}

.activity-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  flex-shrink: 0;
}

body[data-theme="dark"] .activity-icon {
  background: rgba(59, 130, 246, 0.15);
}

.activity-content {
  flex: 1;
}

.activity-content .activity-title {
  color: var(--dark);
  font-weight: 600;
  margin: 0 0 4px 0;
}

.activity-content .activity-desc {
  color: var(--gray);
  font-size: 0.9rem;
  margin: 0;
}

.activity-time {
  font-size: 0.8rem;
  color: var(--gray);
  white-space: nowrap;
}

/* Progress bars */
.progress {
  height: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

body[data-theme="dark"] .progress {
  background: rgba(255, 255, 255, 0.05);
}

.progress-bar {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

/* Module cards */
.module-card {
  padding: 20px;
  text-align: center;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--glass-border);
}

body[data-theme="dark"] .module-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.module-card:hover {
  box-shadow: var(--neon-glow);
}

.module-icon {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--neon-glow);
}

.module-title {
  font-weight: 700;
  margin: 0;
  color: var(--dark);
}

.module-description {
  font-size: 0.85rem;
  color: var(--gray);
  margin: 0;
}

/* Tables */
.glass-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.glass-table th {
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px;
  text-align: left;
  font-size: 0.9rem;
}

body[data-theme="dark"] .glass-table th {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-table td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
  color: var(--dark);
}

body[data-theme="dark"] .glass-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.glass-table tr {
  transition: all 0.2s ease;
}

.glass-table tr:hover {
  background: rgba(37, 99, 235, 0.05);
}

body[data-theme="dark"] .glass-table tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

/* Chart container */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* Notification badge */
.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Mobile Toggle */
.mobile-sidebar-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--neon-glow);
  z-index: 1001;
  transition: all 0.3s ease;
}

.mobile-sidebar-toggle:hover {
}

/* Sidebar toggle in header */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--dark);
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 16px;
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-sidebar-toggle {
    display: flex;
  }

  .sidebar-toggle {
    display: block;
  }
}

/* Utility classes */
.text-xs {
  font-size: 0.82rem;
}
.small-muted {
  font-size: 0.82rem;
  color: var(--gray);
}
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Fancy neon gradient for headers */
.neon-grad {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* Loading animation */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Modal improvements */
.modal-content {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.modal-header {
  border-bottom: 1px solid var(--glass-border);
}

body[data-theme="dark"] .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-footer {
  border-top: 1px solid var(--glass-border);
}

body[data-theme="dark"] .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

body[data-theme="dark"] ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.5);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .mobile-sidebar-toggle,
  .search-bar,
  .icon-btn,
  .theme-toggle {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ------------------------------
   Modal Positioning Fix
   ------------------------------ */
.modal {
  z-index: 1101 !important; /* Higher than sidebar z-index (1100) */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}

.modal.show {
  display: block;
}

.modal-backdrop {
  z-index: 1100 !important; /* Below modal but above sidebar */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
  z-index: 1101 !important;
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}

.modal-content {
  z-index: 1102 !important;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: var(--surface);
  background-clip: padding-box;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-3d);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  outline: 0;
}

/* Glass modal specific styling */
.glass-modal .modal-content {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--neon-glow);
}

.glass-modal .modal-header {
  border-bottom: 1px solid var(--glass-border);
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem;
}

body[data-theme="dark"] .glass-modal .modal-header {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-modal .modal-footer {
  border-top: 1px solid var(--glass-border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 1.5rem;
}

body[data-theme="dark"] .glass-modal .modal-footer {
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-modal .btn-close {
  filter: invert(0.5);
  opacity: 0.7;
}

body[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.glass-modal .btn-close:hover {
  opacity: 1;
}

/* Modal animations */
.modal.fade .modal-dialog {
  transform: scale(0.8) translateY(-50px);
  opacity: 0;
  transition: all var(--transition-speed) ease;
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Ensure modal is always centered and properly sized */
@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }

  .modal-dialog.modal-lg {
    max-width: 800px;
  }

  .modal-dialog.modal-xl {
    max-width: 1140px;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }

  .glass-modal .modal-header,
  .glass-modal .modal-footer {
    padding: 1rem;
  }
}

/* Fix for modal body overflow */
.modal-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 1.5rem;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

body[data-theme="dark"] .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.3);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.5);
}

/* Form styling within modals */
.modal .form-label {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.modal .form-control,
.modal .form-select {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  color: var(--dark);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

body[data-theme="dark"] .modal .form-control,
body[data-theme="dark"] .modal .form-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
}

body[data-theme="dark"] .modal .form-label {
  color: var(--text);
}

.modal .form-control:focus,
.modal .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  background: var(--surface);
}

body[data-theme="dark"] .modal .form-control:focus,
body[data-theme="dark"] .modal .form-select:focus {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.modal .form-control::placeholder {
  color: var(--gray);
}

/* Tab styling within modals */
.modal .nav-pills .nav-link {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  color: var(--dark);
  margin: 0.25rem;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

.modal .nav-pills .nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
  box-shadow: var(--neon-glow);
}

/* Ensure sidebar doesn't interfere with modal display */
.sidebar {
  z-index: 1040 !important; /* Lower than modal backdrop */
}

.main-content {
  position: relative;
  z-index: 1;
}

/* Fix for when sidebar is collapsed */
.main-content.expanded ~ .modal {
  margin-left: 0 !important;
}

/* Print styles for modals */
@media print {
  .modal {
    position: absolute !important;
    z-index: 9999 !important;
  }

  .modal-backdrop {
    display: none !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .modal.fade .modal-dialog {
    transition: none;
  }
}

/* ------------------------------
   Table Dark Mode Styling
   ------------------------------ */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--dark);
  border-color: var(--glass-border);
}

.table-hover tbody tr:hover {
  --bs-table-accent-bg: rgba(37, 99, 235, 0.05);
  color: var(--dark);
}

.table > :not(caption) > * > * {
  background-color: var(--surface);
  border-bottom-color: var(--glass-border);
  color: var(--dark);
}

/* Dark mode specific table styles */
body[data-theme="dark"] .table {
  --bs-table-color: var(--text);
  --bs-table-bg: transparent;
  border-color: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--surface);
  border-bottom-color: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

body[data-theme="dark"] .table-hover tbody tr:hover {
  --bs-table-accent-bg: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

/* Fix visibility of action icons in tables */
.table td a {
  text-decoration: none;
}
.table td i.fa,
.table td i.bi {
  color: var(--dark);
  font-size: 1.1rem;
}
body[data-theme="dark"] .table td i.fa,
body[data-theme="dark"] .table td i.bi {
  color: var(--text);
}
.table td .btn i.fa,
.table td .btn i.bi {
  color: inherit;
}
.table td .text-danger,
.table td .text-danger i {
  color: var(--danger) !important;
}
.table td .text-primary,
.table td .text-primary i {
  color: var(--primary) !important;
}
.table td .text-success,
.table td .text-success i {
  color: var(--success) !important;
}
.table td .text-warning,
.table td .text-warning i {
  color: var(--warning) !important;
}

/* Table header styling */
.table thead th {
  background-color: var(--surface-2);
  border-bottom: 2px solid var(--glass-border);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 1rem;
}

/* GridView Sortable Column Link */
.table thead th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}
.table thead th a:hover,
.table thead th a:focus {
  color: var(--primary-dark);
}
body[data-theme="dark"] .table thead th a:hover {
  color: #fff;
}

/* Sort caret icons */
.table thead th a[data-sort]::after {
  content: "\F142"; /* Bootstrap icons arrow-down-up */
  font-family: "bootstrap-icons", sans-serif;
  font-weight: normal;
  font-style: normal;
  opacity: 0.4;
  font-size: 0.75rem;
  margin-left: 2px;
}
.table thead th a.asc::after {
  content: "\F139"; /* arrow-up */
  opacity: 1;
}
.table thead th a.desc::after {
  content: "\F128"; /* arrow-down */
  opacity: 1;
}

body[data-theme="dark"] .table thead th {
  background-color: rgba(255, 255, 255, 0.05);
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
  color: var(--primary-light);
}

/* Table body styling */
.table tbody td {
  padding: 1rem;
  vertical-align: middle;
  background-color: var(--surface);
  transition: all 0.2s ease;
}

body[data-theme="dark"] .table tbody td {
  background-color: var(--surface);
}

/* Table responsive container */
.table-responsive {
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--surface);
}

body[data-theme="dark"] .table-responsive {
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--surface);
}

/* Text colors in tables */
.table h6 {
  color: var(--dark);
  margin-bottom: 0.25rem;
}

body[data-theme="dark"] .table h6 {
  color: var(--text);
}

.table .small-muted {
  color: var(--gray);
  font-size: 0.8rem;
}

body[data-theme="dark"] .table .small-muted {
  color: var(--muted);
}

/* Badge styling in tables */
.table .badge-glass {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

body[data-theme="dark"] .table .badge-glass {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Status badge variants */
.table .badge-glass.bg-success {
  background: rgba(16, 185, 129, 0.1) !important;
  color: var(--success) !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

body[data-theme="dark"] .table .badge-glass.bg-success {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
}

.table .badge-glass.bg-warning {
  background: rgba(245, 158, 11, 0.1) !important;
  color: var(--warning) !important;
  border: 1px solid rgba(245, 158, 11, 0.2) !important;
}

body[data-theme="dark"] .table .badge-glass.bg-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
}

/* Dropdown in tables */
.table .dropdown .btn-glass {
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--dark);
  padding: 0.375rem 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

body[data-theme="dark"] .table .dropdown .btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.table .dropdown .btn-glass:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
}

body[data-theme="dark"] .table .dropdown .btn-glass:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary-light);
}

/* Dropdown menu styling */
.table .dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-3d);
  backdrop-filter: var(--glass-blur);
}

body[data-theme="dark"] .table .dropdown-menu {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.table .dropdown-item {
  color: var(--dark);
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

body[data-theme="dark"] .table .dropdown-item {
  color: var(--text);
}

.table .dropdown-item:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

body[data-theme="dark"] .table .dropdown-item:hover {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
}

.table .dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger) !important;
}

body[data-theme="dark"] .table .dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Employee image styling */
.table img.rounded-circle {
  border: 2px solid var(--glass-border);
}

body[data-theme="dark"] .table img.rounded-circle {
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Table row hover effects */
.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background-color: rgba(0,0,0,0.01);
}

body[data-theme="dark"] .table tbody tr:hover {
  background-color: rgba(255,255,255,0.03);
}

/* Responsive table adjustments */
@media (max-width: 768px) {
  .table-responsive {
    border: none;
    background: transparent;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
  }

  .table tbody td {
    display: block;
    text-align: right;
    padding: 0.5rem;
    border: none;
    position: relative;
  }

  .table tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    top: 0.5rem;
    font-weight: 600;
    color: var(--primary);
    text-align: left;
  }

  body[data-theme="dark"] .table tbody tr {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
}
/* ------------------------------
   Select Elements Dark Mode Styling
   ------------------------------ */
.form-select {
  background-color: var(--surface-2);
  border: 1px solid var(--glass-border);
  color: var(--dark);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  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='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  background-color: var(--surface);
  color: var(--dark);
}

.form-select:disabled {
  background-color: var(--surface-2);
  color: var(--gray);
  opacity: 0.6;
}

/* Dark mode specific select styles */
body[data-theme="dark"] .form-select {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  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='%2393a7c4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

body[data-theme="dark"] .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

body[data-theme="dark"] .form-select:disabled {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

/* Select option styling */
.form-select option {
  background-color: var(--surface);
  color: var(--dark);
  padding: 0.5rem;
}

body[data-theme="dark"] .form-select option {
  background-color: var(--surface);
  color: var(--text);
}

/* Hover states for options (limited browser support) */
.form-select option:hover,
.form-select option:focus {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

body[data-theme="dark"] .form-select option:hover,
body[data-theme="dark"] .form-select option:focus {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
}

/* Select in modals */
.modal .form-select {
  background-color: var(--surface-2);
  border: 1px solid var(--glass-border);
  color: var(--dark);
}

body[data-theme="dark"] .modal .form-select {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal .form-select:focus {
  background-color: var(--surface);
}

body[data-theme="dark"] .modal .form-select:focus {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Select in tables */
.table .form-select {
  background-color: var(--surface);
  border: 1px solid var(--glass-border);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}

body[data-theme="dark"] .table .form-select {
  background-color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Select in dropdowns */
.dropdown-menu .form-select {
  background-color: var(--surface);
  border: 1px solid var(--glass-border);
  margin: 0.25rem 0.5rem;
  width: calc(100% - 1rem);
}

body[data-theme="dark"] .dropdown-menu .form-select {
  background-color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Small select variant */
.form-select-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  background-size: 12px 8px;
  background-position: right 0.5rem center;
}

/* Large select variant */
.form-select-lg {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  background-size: 18px 14px;
  background-position: right 1rem center;
}

/* Custom select wrapper for better styling */
.select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.select-wrapper::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
  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='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
}

body[data-theme="dark"] .select-wrapper::after {
  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='%2393a7c4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Select with icons */
.select-with-icon {
  padding-left: 2.5rem;
}

.select-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  pointer-events: none;
}

body[data-theme="dark"] .select-icon {
  color: var(--muted);
}

/* Multiple select styling */
.form-select[multiple] {
  background-image: none;
  padding: 0.75rem;
  height: auto;
}

.form-select[multiple] option {
  padding: 0.5rem 0.75rem;
  margin: 0.125rem 0;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.form-select[multiple] option:checked {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

body[data-theme="dark"] .form-select[multiple] option:checked {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
}

/* Select group styling */
.form-select optgroup {
  background-color: var(--surface-2);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.5rem;
}

body[data-theme="dark"] .form-select optgroup {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--primary-light);
}

/* Invalid select states */
.form-select.is-invalid {
  border-color: var(--danger);
  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='%23ef4444' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-select.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

body[data-theme="dark"] .form-select.is-invalid {
  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='%23ef4444' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Valid select states */
.form-select.is-valid {
  border-color: var(--success);
  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='%2310b981' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-select.is-valid:focus {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

body[data-theme="dark"] .form-select.is-valid {
  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='%2310b981' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Select in filter dropdowns */
.filter-select .form-select {
  background-color: var(--surface);
  border: 1px solid var(--glass-border);
  margin: 0.25rem 0;
}

body[data-theme="dark"] .filter-select .form-select {
  background-color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive select adjustments */
@media (max-width: 768px) {
  .form-select {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .modal .form-select {
    padding: 1rem;
  }
}
/* ================================================================
   DARK THEME — COMPREHENSIVE FIX
   Fixes: invisible dropdown items, invisible form inputs,
   invisible text in login/auth forms, button visibility etc.
   ================================================================ */

/* ── 1. Core surface fix — was nearly transparent, now solid ── */
body[data-theme="dark"] {
  --surface: #1a2236; /* solid dark-blue card bg */
  --surface-2: #141c2e; /* slightly deeper for nested surfaces */
  --glass: #111827; /* sidebar / glass bg */
  color-scheme: dark; /* tells browser dark semantics */
}

/* ── 2. Form inputs — GLOBAL (login, all forms outside modal) ── */
body[data-theme="dark"] .form-control,
body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] input[type="email"],
body[data-theme="dark"] input[type="password"],
body[data-theme="dark"] input[type="number"],
body[data-theme="dark"] input[type="tel"],
body[data-theme="dark"] input[type="url"],
body[data-theme="dark"] input[type="date"],
body[data-theme="dark"] input[type="search"],
body[data-theme="dark"] textarea {
  background-color: #1e2d45 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #e2e8f0 !important;
  caret-color: #60a5fa;
}

body[data-theme="dark"] .form-control:focus,
body[data-theme="dark"] input[type="text"]:focus,
body[data-theme="dark"] input[type="email"]:focus,
body[data-theme="dark"] input[type="password"]:focus,
body[data-theme="dark"] input[type="number"]:focus,
body[data-theme="dark"] input[type="tel"]:focus,
body[data-theme="dark"] input[type="url"]:focus,
body[data-theme="dark"] input[type="date"]:focus,
body[data-theme="dark"] input[type="search"]:focus,
body[data-theme="dark"] textarea:focus {
  background-color: #243550 !important;
  border-color: #3b82f6 !important;
  color: #f1f5f9 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

body[data-theme="dark"] .form-control::placeholder,
body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #64748b !important;
  opacity: 1;
}

/* ── 3. Form labels — globally visible in dark mode ── */
body[data-theme="dark"] .form-label,
body[data-theme="dark"] label,
body[data-theme="dark"] .control-label {
  color: #cbd5e1 !important;
}

/* ── 4. Dropdowns — globally solid so items are always visible ── */
body[data-theme="dark"] .dropdown-menu {
  background: #1a2236 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6) !important;
}

body[data-theme="dark"] .dropdown-item {
  color: #cbd5e1 !important;
  background: transparent !important;
}

body[data-theme="dark"] .dropdown-item:hover,
body[data-theme="dark"] .dropdown-item:focus {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #93c5fd !important;
}

body[data-theme="dark"] .dropdown-item.text-danger {
  color: #f87171 !important;
}

body[data-theme="dark"] .dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
}

body[data-theme="dark"] .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .dropdown-header {
  color: #94a3b8 !important;
}

/* ── 5. Modal content — solid bg ── */
body[data-theme="dark"] .modal-content {
  background: #1a2236 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body[data-theme="dark"] .modal-header {
  background: #141c2e !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .modal-footer {
  background: #141c2e !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .modal-title,
body[data-theme="dark"] .modal-header .block-title {
  color: #f1f5f9 !important;
}

/* ── 6. Cards / Blocks ── */
body[data-theme="dark"] .card,
body[data-theme="dark"] .block {
  background: #1a2236 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .card-header,
body[data-theme="dark"] .block-header {
  background: #141c2e !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}

body[data-theme="dark"] .card-body,
body[data-theme="dark"] .block-content {
  background: #1a2236 !important;
  color: #cbd5e1;
}

body[data-theme="dark"] .card-footer,
body[data-theme="dark"] .block-footer {
  background: #141c2e !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ── 7. Text — ensure body text is legible in dark mode ── */
body[data-theme="dark"],
body[data-theme="dark"] p,
body[data-theme="dark"] span,
body[data-theme="dark"] div,
body[data-theme="dark"] li,
body[data-theme="dark"] td,
body[data-theme="dark"] th {
  color: inherit;
}

body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] h5,
body[data-theme="dark"] h6 {
  color: #f1f5f9;
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] .small.text-muted {
  color: #64748b !important;
}

/* ── 8. Input groups ── */
body[data-theme="dark"] .input-group-text {
  background: #1e2d45 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #94a3b8 !important;
}

/* ── 9. Badges in dark mode ── */
body[data-theme="dark"] .badge.bg-light {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
}

body[data-theme="dark"] .bg-body-light,
body[data-theme="dark"] .bg-light {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #cbd5e1;
}

body[data-theme="dark"] .badge.bg-warning.bg-opacity-10 {
  background: rgba(245, 158, 11, 0.2) !important;
}
body[data-theme="dark"] .badge .text-warning,
body[data-theme="dark"] .text-warning {
  color: #fde047 !important; /* Brighter, pastel yellow for readability */
}

/* ── 10. Borders & dividers ── */
body[data-theme="dark"] .border,
body[data-theme="dark"] .border-bottom,
body[data-theme="dark"] .border-top {
  border-color: rgba(255, 255, 255, 0.09) !important;
}

/* ── 11. Alerts ── */
body[data-theme="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fcd34d !important;
}

body[data-theme="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
}

body[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #6ee7b7 !important;
}

body[data-theme="dark"] .alert-info {
  background: rgba(6, 182, 212, 0.15) !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
  color: #67e8f9 !important;
}

/* ── 12. select option bg — browser-rendered, needs OS-level color ── */
body[data-theme="dark"] select option {
  background-color: #1a2236 !important;
  color: #e2e8f0 !important;
}

/* ── 13. Login / Auth page fixes ── */
body[data-theme="dark"] .login-wrapper,
body[data-theme="dark"] .auth-card,
body[data-theme="dark"] .card.shadow {
  background: #1a2236 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ── 14. GridView pagination ── */
body[data-theme="dark"] .pagination .page-link {
  background: #1a2236 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

body[data-theme="dark"] .pagination .page-link:hover {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60a5fa !important;
}

body[data-theme="dark"] .pagination .page-item.active .page-link {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
}

/* ── 15. Form validation feedback ── */
body[data-theme="dark"] .invalid-feedback {
  color: #fca5a5 !important;
}

body[data-theme="dark"] .valid-feedback {
  color: #6ee7b7 !important;
}

body[data-theme="dark"] .form-control.is-invalid,
body[data-theme="dark"] .form-control.is-valid {
  background-image: none;
}

/* ── 16. Scrollbar in dark mode ── */
body[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0f172a;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.35);
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.55);
}

/* ================================================================
   DARK THEME — DROPDOWN & NAV FORCED FIX (high specificity)
   Overrides Bootstrap's hardcoded white background on dropdowns
   ================================================================ */

/* Nuclear option — force all dropdowns in dark mode to be visible */
body[data-theme="dark"] .dropdown-menu,
body[data-theme="dark"] .dropdown-menu.show,
body[data-theme="dark"] [class*="dropdown-menu"] {
  background-color: #1e2d45 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(99, 155, 255, 0.2) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7) !important;
}

body[data-theme="dark"] .dropdown-menu .dropdown-item,
body[data-theme="dark"] .dropdown-menu.show .dropdown-item,
body[data-theme="dark"] .dropdown-menu a,
body[data-theme="dark"] .dropdown-menu button {
  color: #e2e8f0 !important;
  background-color: transparent !important;
}

body[data-theme="dark"] .dropdown-menu .dropdown-item:hover,
body[data-theme="dark"] .dropdown-menu .dropdown-item:focus,
body[data-theme="dark"] .dropdown-menu a:hover,
body[data-theme="dark"] .dropdown-menu button:hover {
  background-color: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

body[data-theme="dark"] .dropdown-menu .dropdown-item.text-danger,
body[data-theme="dark"] .dropdown-menu a.text-danger {
  color: #f87171 !important;
}

body[data-theme="dark"] .dropdown-menu .dropdown-item.text-danger:hover,
body[data-theme="dark"] .dropdown-menu a.text-danger:hover {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
}

body[data-theme="dark"] .dropdown-menu hr,
body[data-theme="dark"] .dropdown-menu .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ── Org Nav Bar dark fix (uses --bs-body-bg which doesn't exist in this theme) ── */
body[data-theme="dark"] .org-module-nav {
  background: #111827 !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .org-nav-tab {
  color: #64748b !important;
}

body[data-theme="dark"] .org-nav-tab:hover {
  color: #93c5fd !important;
  background: rgba(59, 130, 246, 0.12) !important;
}

body[data-theme="dark"] .org-nav-tab.active {
  color: #60a5fa !important;
  border-bottom-color: #3b82f6 !important;
}

/* ── Org hub progress banner ── */
body[data-theme="dark"] .org-progress-banner {
  background: #1a2236 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .org-progress-cta {
  background: #141c2e !important;
  border-color: rgba(99, 155, 255, 0.15) !important;
}

body[data-theme="dark"] .org-step-pill.done {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.25) !important;
}

body[data-theme="dark"] .org-step-pill.pending {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #64748b !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ── Org module cards ── */
body[data-theme="dark"] .org-module-card {
  background: #1a2236 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}

body[data-theme="dark"] .org-module-card:hover {
  border-color: transparent !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5) !important;
  color: #e2e8f0 !important;
}

body[data-theme="dark"] .org-module-card.card-pending {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

body[data-theme="dark"] .org-module-card-title {
  color: #f1f5f9 !important;
}

body[data-theme="dark"] .org-module-card-desc {
  color: #64748b !important;
}

/* ── Org stat chips ── */
body[data-theme="dark"] .org-stat-chip {
  background: #1a2236 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"] .org-stat-chip-count {
  color: #f1f5f9 !important;
}

body[data-theme="dark"] .org-stat-chip-label {
  color: #64748b !important;
}

/* ── Global: Make sure all page text visible in dark ── */
body[data-theme="dark"] .content,
body[data-theme="dark"] .block-content,
body[data-theme="dark"] .card-body {
  color: #cbd5e1;
}

body[data-theme="dark"] .block-title,
body[data-theme="dark"] .content-page-header h5 {
  color: #f1f5f9 !important;
}

/* ── Fix Bootstrap's own bg-body variable not being set ── */
body[data-theme="dark"] {
  --bs-body-bg: #0f172a;
  --bs-body-color: #cbd5e1;
  --bs-border-color: rgba(255, 255, 255, 0.09);
  --bs-secondary-color: #64748b;
  --bs-tertiary-bg: #141c2e;
}

/* ================================================================
   DARK THEME — html-level selector support
   The inline <script> sets data-theme on <html> before body loads.
   Mirror all body[data-theme="dark"] rules to html[data-theme="dark"]
   so the FOUC-prevention script works correctly.
   ================================================================ */

html[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary: #0f172a;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --dark: #f8fafc;
  --light: #1e293b;
  --gray: #94a3b8;
  --gray-light: #334155;
  --glass: #111827;
  --shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --surface: #1a2236;
  --surface-2: #141c2e;
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 50px rgba(2, 6, 23, 0.6);
  --text: #e2e8f0;
  --muted: #64748b;
  --accent-neon: #8b5cf6;
  --glass-3d: 0 12px 40px rgba(0, 0, 0, 0.6);
  --neon-glow: 0 10px 40px rgba(59, 130, 246, 0.18);
  /* Bootstrap variables */
  --bs-body-bg: #0f172a;
  --bs-body-color: #cbd5e1;
  --bs-border-color: rgba(255, 255, 255, 0.09);
  --bs-secondary-color: #64748b;
  --bs-tertiary-bg: #141c2e;
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}

html[data-theme="dark"] .sidebar {
  background: var(--glass) !important;
  border-right-color: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] .brand-title,
html[data-theme="dark"] .user-name {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .nav-link {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link.active {
  color: var(--primary) !important;
  background: rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .dropdown-menu.show {
  background-color: #1e2d45 !important;
  border-color: rgba(99, 155, 255, 0.2) !important;
}

html[data-theme="dark"] .dropdown-item {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .dropdown-item:hover {
  background-color: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

html[data-theme="dark"] .dropdown-item.text-danger {
  color: #f87171 !important;
}

/* ================================================================
   DARK THEME — SIDEBAR TEXT VISIBILITY FINAL FIX
   Ensures all sidebar text, brand name, user details are readable
   ================================================================ */

/* All sidebar text should be explicitly light in dark mode */
body[data-theme="dark"] .brand-title,
html[data-theme="dark"] .brand-title {
  color: #f1f5f9 !important;
}

body[data-theme="dark"] .user-name,
html[data-theme="dark"] .user-name {
  color: #e2e8f0 !important;
}

body[data-theme="dark"] .user-role,
html[data-theme="dark"] .user-role {
  color: #64748b !important;
}

/* Sidebar nav links — ALL of them, including submenu items */
body[data-theme="dark"] .nav-link,
html[data-theme="dark"] .nav-link {
  color: #94a3b8 !important;
}

body[data-theme="dark"] .nav-link span,
html[data-theme="dark"] .nav-link span {
  color: inherit !important;
}

body[data-theme="dark"] .nav-link i,
html[data-theme="dark"] .nav-link i {
  color: inherit !important;
}

body[data-theme="dark"] .nav-link:hover,
body[data-theme="dark"] .nav-link.active,
html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link.active {
  color: #60a5fa !important;
  background: rgba(59, 130, 246, 0.14) !important;
}

/* Submenu parent label (non-clickable title) */
body[data-theme="dark"] .nav-submenu-label,
html[data-theme="dark"] .nav-submenu-label {
  color: #475569 !important;
}

body[data-theme="dark"] .nav-submenu .nav-link,
html[data-theme="dark"] .nav-submenu .nav-link {
  color: #64748b !important;
}

body[data-theme="dark"] .nav-submenu .nav-link:hover,
body[data-theme="dark"] .nav-submenu .nav-link.active,
html[data-theme="dark"] .nav-submenu .nav-link:hover,
html[data-theme="dark"] .nav-submenu .nav-link.active {
  color: #60a5fa !important;
}

/* Sidebar footer */
body[data-theme="dark"] .sidebar-footer,
html[data-theme="dark"] .sidebar-footer {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

/* page body bg — prevents white flash on html before body bg kicks in */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #0f172a !important;
}

/* SweetAlert Dark Theme Support */
body[data-theme="dark"] .swal2-popup {
  background: var(--light) !important;
  color: var(--text) !important;
  border: 1px solid var(--glass-border) !important;
}
body[data-theme="dark"] .swal2-title,
body[data-theme="dark"] .swal2-html-container {
  color: var(--text) !important;
}
body[data-theme="dark"] .swal2-icon.swal2-success {
  border-color: #10b981 !important;
}
body[data-theme="dark"]
  .swal2-icon.swal2-success
  [class^="swal2-success-line"] {
  background-color: #10b981 !important;
}
body[data-theme="dark"] .swal2-success-circular-line-left,
body[data-theme="dark"] .swal2-success-circular-line-right,
body[data-theme="dark"] .swal2-success-fix {
  background-color: var(--light) !important;
}

/* List Groups / Archives Dark Theme Fixes */
body[data-theme="dark"] .list-group-item {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--text) !important;
}
body[data-theme="dark"] .list-group-item .text-muted {
  color: var(--muted) !important;
}
body[data-theme="dark"] .list-group-item-action:hover,
body[data-theme="dark"] .list-group-item-action:focus {
  background-color: rgba(255, 255, 255, 0.07) !important;
}

/* --- GLOBAL THEME UTILITIES --- */
.text-theme { color: var(--text) !important; }
.text-muted-theme { color: var(--muted) !important; }
.bg-theme { background-color: var(--light) !important; }
.border-theme { border-color: var(--glass-border) !important; }

/* Dark mode specific overrides for standard Bootstrap and blocks */
body[data-theme="dark"] {
  color: var(--text);
  background-color: var(--bg);
}

body[data-theme="dark"] .bg-white,
body[data-theme="dark"] .bg-body-extra-light,
body[data-theme="dark"] .block,
body[data-theme="dark"] .card {
  background-color: var(--surface) !important;
  color: var(--text);
  border-color: var(--glass-border) !important;
}

body[data-theme="dark"] .bg-body-light,
body[data-theme="dark"] .list-group-item,
body[data-theme="dark"] .table thead th {
  background-color: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--glass-border) !important;
}

body[data-theme="dark"] .text-dark,
body[data-theme="dark"] .fw-bold.text-dark {
  color: var(--text) !important;
}

body[data-theme="dark"] .text-muted {
  color: var(--muted) !important;
}

body[data-theme="dark"] .nav-pills .nav-link.active {
  background-color: var(--primary) !important;
  color: #fff !important;
}

body[data-theme="dark"] .nav-pills .nav-link:not(.active) {
  color: var(--muted) !important;
}

body[data-theme="dark"] .nav-pills .nav-link:not(.active):hover {
  background-color: var(--surface-2);
  color: var(--text) !important;
}

body[data-theme="dark"] .border-primary {
  border-color: var(--primary) !important;
}

body[data-theme="dark"] .bg-primary-bg-subtle,
body[data-theme="dark"] [style*="background: var(--bs-primary-bg-subtle"] {
  background-color: rgba(59, 130, 246, 0.15) !important;
}

/* Recruitment Specific Badge Visibility */
.badge.bg-indigo-light { background-color: rgba(99, 102, 241, 0.1); color: #6366f1; border: 1px solid rgba(99, 102, 241, 0.2); }
.badge.bg-info-light { background-color: rgba(6, 182, 212, 0.1); color: #06b6d4; border: 1px solid rgba(6, 182, 212, 0.2); }
.badge.bg-success-light { background-color: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge.bg-warning-light { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge.bg-danger-light { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }

body[data-theme="dark"] .badge {
  font-weight: 600;
}

/* Fix for standard Bootstrap list group hover in dark mode */
body[data-theme="dark"] .list-group-item-action:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--primary) !important;
}

/* Button Visibility Fixes for Dark Mode */
body[data-theme="dark"] .btn-alt-primary {
  background-color: rgba(67, 97, 238, 0.2) !important;
  color: #fff !important;
  border: 1px solid rgba(67, 97, 238, 0.3) !important;
  font-weight: 600;
}
body[data-theme="dark"] .btn-alt-primary:hover {
  background-color: var(--primary) !important;
  color: #fff !important;
}

body[data-theme="dark"] .btn-alt-secondary {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--text) !important;
  border: 1px solid var(--glass-border) !important;
  font-weight: 600;
}
body[data-theme="dark"] .btn-alt-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-color: var(--primary) !important;
}

body[data-theme="dark"] .btn-alt-info {
  background-color: rgba(129, 140, 248, 0.15) !important;
  color: var(--info) !important;
  border: 1px solid rgba(129, 140, 248, 0.2) !important;
}

/* Premium Dashboard Elements */
.card-premium {
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--glass-border);
  background: var(--surface);
}

body[data-theme="dark"] .card-premium {
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.card-premium:hover {
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

body[data-theme="dark"] .card-premium:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.icon-box {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--transition);
}

.card-premium:hover .icon-box {
}

.stat-label {
  font-size: 0.75rem;
  letter-spacing: 0.05rem;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.7;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
}

/* Glass effect for icons */
.bg-glass-primary { background: rgba(67, 97, 238, 0.1); color: var(--primary); }
.bg-glass-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.bg-glass-info { background: rgba(6, 182, 212, 0.1); color: var(--info); }
.bg-glass-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }

/* Ensure 'View All' and other global links are visible */
body[data-theme="dark"] .btn-link {
  color: var(--primary) !important;
}

