/* ============================================================
   FALCON IMS — Main Stylesheet
   Supports: Light/Dark mode, LTR/RTL (Arabic), Responsive
   ============================================================ */

/* ---- Google Fonts loaded in template ---- */

/* ---- CSS Variables ---- */
:root {
  --sidebar-w: 258px;
  --sidebar-collapsed-w: 68px;
  --navbar-h: 62px;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: 0.22s ease;

  /* Light theme */
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #111318;
  --bg-navbar: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f5f7fa;
  --bg-thead: #f8f9fb;

  --txt: #111827;
  --txt-muted: #6b7280;
  --txt-sidebar: #dde3ee;
  --txt-sidebar-dim: #8895aa;

  --border: #e5e7eb;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --primary-bg: #eff6ff;

  --green:  #22c55e;
  --blue:   #3b82f6;
  --orange: #f97316;
  --red:    #ef4444;

  /* Softened, lower-contrast palette — matches the dashboard chart's mute(0.4)
     (each base color blended 40% toward mid-gray). Used by the stat cards and
     status pills so they read as one system with the chart. */
  --green-soft:   #48a96c;
  --blue-soft:    #5781c7;
  --orange-soft:  #c97840;
  --red-soft:     #c35c5c;
  --primary-soft: #496fc0;
}

[data-theme="dark"] {
  --bg:         #212f2d;
  --bg-card:    #293f3c;
  --bg-sidebar: #1a2826;
  --bg-navbar:  #293f3c;
  --bg-input:   #314847;
  --bg-hover:   #3c5350;
  --bg-thead:   #314847;

  --txt:             #e0edea;
  --txt-muted:       #7fb5ae;
  --txt-sidebar:     #d0e4e0;
  --txt-sidebar-dim: #6aa39c;

  --border:     #415e5a;
  --shadow-xs:  0 1px 2px rgba(0,0,0,.18);
  --shadow-sm:  0 1px 4px rgba(0,0,0,.22);
  --shadow-md:  0 4px 16px rgba(0,0,0,.30);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.40);

  --primary-bg: rgba(37,99,235,.14);

  /* Override Bootstrap's own CSS variables so utilities (text-muted, borders, etc.) adapt */
  --bs-body-color:      #e0edea;
  --bs-body-bg:         #212f2d;
  --bs-secondary-color: #7fb5ae;   /* drives .text-muted */
  --bs-border-color:    #415e5a;
  --bs-tertiary-bg:     #314847;
  --bs-secondary-bg:    #3c5350;
  --bs-emphasis-color:  #e0edea;

  /* Bootstrap -subtle variant colours (badges, borders) */
  --bs-success-bg-subtle:        rgba(34, 197, 94,  .13);
  --bs-success-border-subtle:    rgba(34, 197, 94,  .35);
  --bs-danger-bg-subtle:         rgba(239, 68, 68,  .13);
  --bs-danger-border-subtle:     rgba(239, 68, 68,  .35);
  --bs-primary-bg-subtle:        rgba(37,  99, 235, .15);
  --bs-primary-border-subtle:    rgba(37,  99, 235, .38);
  --bs-warning-bg-subtle:        rgba(249, 115, 22, .13);
  --bs-warning-border-subtle:    rgba(249, 115, 22, .35);
  --bs-info-bg-subtle:           rgba(59,  130, 246,.13);
  --bs-info-border-subtle:       rgba(59,  130, 246,.35);
  --bs-secondary-bg-subtle:      rgba(107, 114, 128,.13);
  --bs-secondary-border-subtle:  rgba(107, 114, 128,.35);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  transition: background var(--ease), color var(--ease);
}

[lang="ar"] body, [lang="ar"] * {
  font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif;
}

a { color: var(--primary); }
a:hover { color: var(--primary-d); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--ease), width var(--ease);
  will-change: transform, width;
}

.sidebar-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.055);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 1.55rem; line-height: 1; }
.brand-text { font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: .01em; }

.sidebar-close {
  background: none; border: none; color: var(--txt-sidebar-dim);
  font-size: 1rem; padding: 6px 9px; border-radius: 6px; cursor: pointer;
  transition: all var(--ease);
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,.09); }

/* Nav Links */
.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.nav-section-label {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--txt-sidebar-dim);
  padding: 6px 12px 8px; user-select: none;
}

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--txt-sidebar); text-decoration: none;
  font-weight: 500; font-size: .875rem; margin-bottom: 1px;
  transition: background var(--ease), color var(--ease);
}
.sidebar-nav .nav-link i { font-size: .95rem; width: 18px; text-align: center; opacity: .65; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link:hover i { opacity: 1; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }
.sidebar-nav .nav-link.active i { opacity: 1; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.055);
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: .82rem; font-weight: 600; color: var(--txt-sidebar); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-badge {
  display: inline-block; font-size: .65rem; padding: 1px 7px;
  background: rgba(255,255,255,.09); color: var(--txt-sidebar-dim);
  border-radius: 20px; margin-top: 2px;
}

/* Overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.52); z-index: 999;
  backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-wrapper {
  margin-inline-start: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--ease);
}

/* Top Navbar */
.top-navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--navbar-h);
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 10px;
  box-shadow: var(--shadow-xs);
  transition: background var(--ease), border-color var(--ease);
}

.navbar-toggler-btn {
  font-size: 1.3rem; color: var(--txt-muted);
  background: none; border: none; padding: 5px 9px;
  border-radius: 7px; cursor: pointer; transition: all var(--ease);
}
.navbar-toggler-btn:hover { background: var(--bg-hover); color: var(--txt); }

.navbar-title { font-weight: 600; font-size: .9rem; color: var(--txt); }

.navbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--txt-muted); background: none;
  border: 1px solid transparent; font-size: .9rem;
  cursor: pointer; transition: all var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--txt); border-color: var(--border); }

.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
}
.user-btn { width: auto !important; padding: 3px 6px !important; gap: 5px; }

/* Page Content */
.page-content { flex: 1; padding: 24px 26px; }

.content-header { margin-bottom: 22px; }
.content-title { font-size: 1.45rem; font-weight: 700; color: var(--txt); margin-bottom: 3px; }
.content-subtitle { color: var(--txt-muted); font-size: .875rem; }

.flash-container { margin-bottom: 18px; }
.flash-container .alert { border: none; border-radius: var(--radius); font-size: .875rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: background var(--ease), border-color var(--ease);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.card-title { font-size: .9rem; font-weight: 600; color: var(--txt); }
.card-body { padding: 18px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background var(--ease);
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-total::before   { background: var(--primary-soft); }
.stat-available::before { background: var(--green-soft); }
.stat-breed::before   { background: var(--blue-soft); }
.stat-given::before   { background: var(--orange-soft); }
.stat-dead::before    { background: var(--red-soft); }

.stat-icon { font-size: 1.3rem; margin-bottom: 6px; }
.stat-total   .stat-icon { color: var(--primary-soft); }
.stat-available .stat-icon { color: var(--green-soft); }
.stat-breed   .stat-icon { color: var(--blue-soft); }
.stat-given   .stat-icon { color: var(--orange-soft); }
.stat-dead    .stat-icon { color: var(--red-soft); }

.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--txt); line-height: 1; }
.stat-label { font-size: .72rem; color: var(--txt-muted); font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* ============================================================
   TABLES
   ============================================================ */
.table { color: var(--txt); margin: 0; }
.table thead th {
  background: var(--bg-thead); color: var(--txt-muted);
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  border-color: var(--border); padding: 11px 16px;
  white-space: nowrap;
}
.table tbody td {
  border-color: var(--border);
  padding: 11px 16px;
  font-size: .87rem; vertical-align: middle;
}
.table-hover tbody tr:hover { background: var(--bg-hover); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 20px;
  font-size: .76rem; font-weight: 600; border: none;
  white-space: nowrap;
}
.status-badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
}

.status-available { background: #e3f7ea; color: #2f9e63; }
.status-dead      { background: #fdeaea; color: #c25858; }
.status-breed     { background: #e6eefb; color: #4f74c8; }
.status-given     { background: #fdf0e2; color: #bd7134; }

[data-theme="dark"] .status-available { background: transparent; border: 1px solid #2a7a62; color: #5ec4a8; }
[data-theme="dark"] .status-dead      { background: transparent; border: 1px solid #7a2a2a; color: #c47a7a; }
[data-theme="dark"] .status-breed     { background: transparent; border: 1px solid #2a427a; color: #7a9dc4; }
[data-theme="dark"] .status-given     { background: transparent; border: 1px solid #7a4a2a; color: #c4946a; }

/* Status dot in dropdown */
.status-dot-sm {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.status-dot-available { background: var(--green); }
.status-dot-dead      { background: var(--red); }
.status-dot-breed     { background: var(--blue); }
.status-dot-given     { background: var(--orange); }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--txt);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: .875rem;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.form-control:focus, .form-select:focus {
  background: var(--bg-input); border-color: var(--primary); color: var(--txt);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15); outline: none;
}
.form-control::placeholder { color: var(--txt-muted); opacity: .6; }
.form-label { font-size: .83rem; color: var(--txt-muted); margin-bottom: 5px; }
.input-group-text {
  background: var(--bg-thead); border-color: var(--border); color: var(--txt-muted);
}
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--red); }
.invalid-feedback { font-size: .8rem; }
.form-check-input { background-color: var(--bg-input); border-color: var(--border); }
.form-switch .form-check-input { width: 2.2em; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: .875rem; transition: all var(--ease); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-outline-secondary { color: var(--txt-muted); border-color: var(--border); background: transparent; }
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--txt); border-color: var(--border); }
.btn-secondary { background: var(--bg-thead); border-color: var(--border); color: var(--txt-muted); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--txt); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-outline-danger { color: var(--red); border-color: var(--red); }
.btn-outline-danger:hover { background: var(--red); color: #fff; }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown-menu {
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); border-radius: var(--radius-sm);
  font-size: .875rem; min-width: 160px;
}
.dropdown-item { color: var(--txt); padding: 7px 14px; display: flex; align-items: center; gap: 7px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-hover); color: var(--txt); }
.dropdown-item.active { background: var(--primary-bg); color: var(--primary); }
.dropdown-header { color: var(--txt-muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.dropdown-item-text { color: var(--txt); padding: 5px 14px; display: block; }
.dropdown-divider { border-color: var(--border); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--txt);
}
.modal-header, .modal-body, .modal-footer { color: var(--txt); }

/* ============================================================
   FLOATING ACTION BUTTON
   ============================================================ */
.fab {
  position: fixed; bottom: 22px;
  inset-inline-end: 22px;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 1.45rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,.45);
  text-decoration: none; z-index: 500;
  transition: transform .15s ease, box-shadow .15s ease;
}
.fab:hover { color: #fff; transform: scale(1.08); box-shadow: 0 6px 24px rgba(37,99,235,.55); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 56px 20px; }
.empty-icon { font-size: 3.5rem; margin-bottom: 14px; opacity: .35; }
.empty-state h3 { font-size: 1.15rem; font-weight: 600; color: var(--txt); margin-bottom: 6px; }
.empty-state p { color: var(--txt-muted); font-size: .88rem; }

/* ============================================================
   FALCON DETAIL
   ============================================================ */
.falcon-avatar {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--primary-bg); font-size: 3rem;
  display: flex; align-items: center; justify-content: center;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; }
.detail-item { padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail-item:nth-last-child(-n+2) { border-bottom: none; }
.detail-label { font-size: .7rem; color: var(--txt-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px; }
.detail-value { font-size: .875rem; font-weight: 500; color: var(--txt); }

/* ============================================================
   ADMIN / USERS
   ============================================================ */
.user-avatar-lg {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .875rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ============================================================
   CHART LEGEND
   ============================================================ */
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--txt-muted); margin-bottom: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert-success { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.alert-danger  { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.alert-info    { background: #dbeafe; border-color: #bfdbfe; color: #1e40af; }
[data-theme="dark"] .alert-success { background: #14532d22; border-color: #15803d; color: #4ade80; }
[data-theme="dark"] .alert-danger  { background: #7f1d1d22; border-color: #b91c1c; color: #f87171; }
[data-theme="dark"] .alert-warning { background: #78350f22; border-color: #92400e; color: #fbbf24; }
[data-theme="dark"] .alert-info    { background: #1e3a8a22; border-color: #1d4ed8; color: #60a5fa; }

/* ============================================================
   BADGE OVERRIDES
   ============================================================ */
.bg-primary-subtle { background: var(--primary-bg) !important; }
.text-primary { color: var(--primary) !important; }
.badge { font-weight: 600; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex;
  background: var(--bg); align-items: center; justify-content: center;
}
.login-container { width: 100%; max-width: 430px; padding: 20px; }
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 38px 36px;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-icon { font-size: 2.8rem; display: block; margin-bottom: 10px; }
.login-title { font-size: 1.5rem; font-weight: 800; color: var(--txt); margin: 0 0 3px; }
.login-subtitle { color: var(--txt-muted); font-size: .875rem; margin: 0; }

/* ============================================================
   SIDEBAR COLLAPSED (desktop only)
   ============================================================ */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
  }
  body.sidebar-collapsed .main-wrapper {
    margin-inline-start: var(--sidebar-collapsed-w);
  }

  /* Hide text / labels */
  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .sidebar-nav .nav-link > span,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .user-details {
    display: none;
  }

  /* Re-centre items */
  body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-inline: 0;
  }
  body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 9px 0;
    gap: 0;
    position: relative;
  }
  body.sidebar-collapsed .sidebar-nav .nav-link i {
    width: 24px;
    text-align: center;
    opacity: .75;
  }
  body.sidebar-collapsed .sidebar-nav .nav-link.active i { opacity: 1; }
  body.sidebar-collapsed .user-info { justify-content: center; }
  body.sidebar-collapsed .sidebar-footer { padding-inline: 0; }

  /* Hover tooltip */
  body.sidebar-collapsed .sidebar-nav [data-label]::after {
    content: attr(data-label);
    position: absolute;
    inset-inline-start: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 20, 30, .93);
    color: #fff;
    font-size: .78rem;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s .35s;
    z-index: 2000;
  }
  body.sidebar-collapsed .sidebar-nav [data-label]:hover::after {
    opacity: 1;
    transition-delay: .35s;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-inline-start: 0 !important; }
  .page-content { padding: 16px; }
}

@media (max-width: 575.98px) {
  .stat-value { font-size: 1.65rem; }
  .content-title { font-size: 1.2rem; }
  .login-card { padding: 28px 20px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item:last-child { border-bottom: none; }
  .detail-item:nth-last-child(2) { border-bottom: 1px solid var(--border); }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--txt-muted); }

/* ============================================================
   TABLE RESPONSIVE
   ============================================================ */
.table-responsive { border-radius: var(--radius); }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.link-primary { color: var(--primary) !important; }
.link-primary:hover { color: var(--primary-d) !important; }
.border-top { border-top-color: var(--border) !important; }

/* ============================================================
   DARK MODE — BOOTSTRAP COMPONENT FIXES
   Text/badge/button/table overrides so Bootstrap utilities
   adapt to our custom data-theme attribute.
   ============================================================ */

/* Bootstrap text utilities — Bootstrap uses its own vars by default */
[data-theme="dark"] .text-muted     { color: var(--txt-muted) !important; }
[data-theme="dark"] .text-secondary { color: var(--txt-muted) !important; }
[data-theme="dark"] .text-success   { color: #4ade80 !important; }
[data-theme="dark"] .text-danger    { color: #f87171 !important; }
[data-theme="dark"] .text-warning   { color: #fbbf24 !important; }
[data-theme="dark"] .text-info      { color: #60a5fa !important; }

/* Close button — Bootstrap uses a black SVG; invert it for dark backgrounds */
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* table-light thead — Bootstrap sets a white background; override for dark */
[data-theme="dark"] .table-light {
  --bs-table-bg:           var(--bg-thead);
  --bs-table-color:        var(--txt-muted);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg:   var(--bg-hover);
}
[data-theme="dark"] .table-light th,
[data-theme="dark"] .table-light td { color: var(--txt-muted) !important; }

/* Pagination — Bootstrap hard-codes white/light backgrounds */
[data-theme="dark"] .pagination {
  --bs-pagination-bg:                   var(--bg-card);
  --bs-pagination-color:                var(--primary);
  --bs-pagination-border-color:         var(--border);
  --bs-pagination-hover-bg:             var(--bg-hover);
  --bs-pagination-hover-color:          var(--txt);
  --bs-pagination-hover-border-color:   var(--border);
  --bs-pagination-focus-bg:             var(--bg-hover);
  --bs-pagination-focus-color:          var(--txt);
  --bs-pagination-disabled-bg:          var(--bg-card);
  --bs-pagination-disabled-color:       var(--txt-muted);
  --bs-pagination-disabled-border-color:var(--border);
  --bs-pagination-active-bg:            var(--primary);
  --bs-pagination-active-border-color:  var(--primary);
  --bs-pagination-active-color:         #fff;
}

/* Solid bg-secondary badge (role/status labels) */
[data-theme="dark"] .badge.bg-secondary {
  background-color: #4e6460 !important;
  color: var(--txt) !important;
}

/* form-check labels inherit body color which may be stale from Bootstrap */
[data-theme="dark"] .form-check-label { color: var(--txt); }
