/* ================================================================
   THEME TOKENS — TPhish Portal
   Toggled via: html.dark class (dark) | dir="rtl" attr (Arabic)
================================================================ */

:root {
  /* Backgrounds */
  --bg:            #eef2f9;    /* body — cool blue-gray */
  --bg-elevated:   #ffffff;   /* cards, panels, modals */
  --bg-soft:       #e2eaf6;   /* table rows, inputs */

  /* Foregrounds */
  --fg:            #0f172a;
  --fg-soft:       #3d4e6a;
  --fg-muted:      #6b7a99;

  /* Accent */
  --accent:        #2563eb;
  --accent-soft:   rgba(37, 99, 235, 0.1);
  --accent-strong: #1d4ed8;

  /* Borders */
  --border-subtle: #cfd9ed;
  --border-strong: #adbad6;

  /* Danger */
  --danger:        #ef4444;
  --danger-soft:   rgba(239, 68, 68, 0.1);

  /* Radii */
  --radius-lg:   16px;
  --radius-md:   10px;
  --radius-sm:   7px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-soft:   0 8px 32px rgba(15, 23, 42, 0.14);
  --shadow-subtle: 0 2px 10px rgba(15, 23, 42, 0.08);

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-med:  220ms ease-out;

  /* Font – system stack only, no external import */
  --font-main: system-ui, -apple-system, BlinkMacSystemFont,
               "SF Pro Text", "Segoe UI", sans-serif;
  --font-arabic: "Tajawal", "Cairo", system-ui, sans-serif;

  /* Nav */
  --nav-height: 64px;
  --subnav-height: 48px;
}

html.dark {
  --bg:            #040c1e;   /* body — deep navy */
  --bg-elevated:   #0b1830;  /* cards, panels, modals */
  --bg-soft:       #101f3c;  /* table rows, inputs */

  --fg:            #e2e8f5;
  --fg-soft:       #9ab5d5;
  --fg-muted:      #8faece;

  --accent:        #60a5fa;
  --accent-soft:   rgba(96, 165, 250, 0.13);
  --accent-strong: #3b82f6;

  --border-subtle: #162843;
  --border-strong: #1e3a5f;

  --shadow-soft:   0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ================================================================
   GLOBAL BASE
================================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* Override Bootstrap's 10px root to restore sensible rem baseline */
html { font-size: 15px !important; }

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 15px !important;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
  transition: background var(--transition-med), color var(--transition-med);
  padding-top: 112px !important;  /* 64px navbar + 48px subnav */
}

html[dir="rtl"] body {
  font-family: var(--font-arabic);
}

.container {
  width: min(1120px, 100% - 2.5rem);
  margin: 0 auto;
}

/* ================================================================
   BUTTONS (spec §3)
================================================================ */
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 9px 22px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  transition: transform var(--transition-fast), box-shadow var(--transition-med);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary:hover,
.btn--primary:focus {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  color: #fff;
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--fg-soft);
  border-radius: var(--radius-pill);
  padding: 9px 22px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-main);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn--ghost:hover,
.btn--ghost:focus {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn--danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-med);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn--danger:hover,
.btn--danger:focus {
  transform: translateY(-1px) scale(1.03);
  box-shadow: var(--shadow-soft);
  color: #fff;
  text-decoration: none;
}

/* ================================================================
   SCROLLBAR
================================================================ */
* { scrollbar-width: thin; scrollbar-color: var(--fg-muted) var(--bg); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background-color: var(--fg-muted);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--fg-soft); }

/* ================================================================
   SITE NAVBAR  (spec §8)
   – Fixed top, height = var(--nav-height) = 72px
   – Hides on scroll-down, reveals on scroll-up
================================================================ */
.site-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  z-index: 1030;
  background: #0d1f40;           /* dark navy — both modes */
  border-bottom: 1px solid #1a3060;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  transition: transform var(--transition-med);
}
html.dark .site-navbar {
  background: #060f22;
  border-bottom-color: #162843;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

/* Navbar controls — always on dark background in both modes */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #dce8ff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}
.nav-logo img { height: 30px; }
.nav-logo:hover { color: #93c5fd; text-decoration: none; }

.nav-icon-btn {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.13);
  color: rgba(210,228,255,0.85);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-main);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  line-height: 1;
}
.nav-icon-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-color: rgba(255,255,255,0.28);
}

.nav-user-name {
  font-weight: 600;
  color: rgba(210,228,255,0.85);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  line-height: 1;
}
.nav-user-name:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
  text-decoration: none;
}
.site-navbar.nav--hidden { transform: translateY(-100%); }

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  max-width: 1400px;
  margin: 0 auto;
  gap: 12px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: rgba(210,228,255,0.7);
  border-radius: 2px;
  transition: all var(--transition-fast);
}
.nav-hamburger:hover span { background: #fff; }

/* Mobile menu */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1029;
}
.nav-mobile-overlay.open { display: block; }

.nav-mobile-menu {
  position: fixed;
  top: 0; left: 0;
  width: 280px; height: 100%;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-subtle);
  z-index: 1031;
  padding: 80px 1.25rem 2rem;
  transform: translateX(-100%);
  transition: transform var(--transition-med);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
html[dir="rtl"] .nav-mobile-menu {
  left: auto; right: 0;
  border-right: none;
  border-left: 1px solid var(--border-subtle);
  transform: translateX(100%);
}
.nav-mobile-menu.open { transform: translateX(0) !important; }
.nav-mobile-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--fg-soft);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 15px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-mobile-menu a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .nav-user-name,
  .nav-controls > a.btn--danger,
  .nav-controls > a.btn--primary { display: none; }
}

/* ================================================================
   SECONDARY NAVIGATION  (horizontal page-level nav)
================================================================ */
.top-navigation {
  position: fixed !important;
  top: var(--nav-height) !important;
  left: 0;
  right: 0;
  height: var(--subnav-height);
  z-index: 1000 !important;
  overflow-x: auto;
  overflow-y: hidden;
  background: #0b1424 !important;
  border-bottom: 1px solid #1c2d47 !important;
  box-shadow: 0 1px 0 rgba(96,165,250,0.06) !important;
  scrollbar-width: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
  will-change: transform;
}
.top-navigation.nav-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.top-navigation::-webkit-scrollbar { display: none; }

html:not(.dark) .top-navigation {
  background: #f4f8ff !important;
  border-bottom: 1px solid #d5e0f5 !important;
  box-shadow: 0 2px 8px rgba(13,31,64,0.09) !important;
}

.nav-horizontal {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0 12px;
  align-items: center;
  height: 100%;
  gap: 2px;
}

.nav-horizontal > li {
  display: flex;
  align-items: center;
  position: relative;
}

.nav-horizontal > li > a {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 5px 13px !important;
  border-radius: 7px !important;
  color: rgba(160,185,220,0.75) !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  white-space: nowrap !important;
  border: none !important;
  border-bottom: none !important;
  background: transparent !important;
  transition: color 0.15s ease, background 0.15s ease !important;
}

.nav-horizontal > li > a i {
  font-size: 13px !important;
  flex-shrink: 0;
}

.nav-horizontal > li > a:hover {
  color: #e2eaf8 !important;
  background: rgba(96,165,250,0.1) !important;
  border-bottom: none !important;
}

.nav-horizontal > li.active > a {
  color: #7db8f7 !important;
  background: rgba(96,165,250,0.15) !important;
  font-weight: 600 !important;
  border-bottom: none !important;
}

.nav-horizontal > li.active > a i {
  color: #60a5fa !important;
}

/* light mode overrides */
html:not(.dark) .nav-horizontal > li > a {
  color: rgba(15,30,75,0.58) !important;
}
html:not(.dark) .nav-horizontal > li > a:hover {
  color: #1d4ed8 !important;
  background: rgba(37,99,235,0.09) !important;
}
html:not(.dark) .nav-horizontal > li.active > a {
  color: #1d4ed8 !important;
  background: rgba(37,99,235,0.12) !important;
  font-weight: 600 !important;
}
html:not(.dark) .nav-horizontal > li.active > a i {
  color: #2563eb !important;
}

.nav-badge {
  background: rgba(96,165,250,0.15) !important;
  color: #60a5fa !important;
  border-radius: 5px !important;
  padding: 1px 6px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.4px !important;
  text-transform: uppercase !important;
}

.nav-divider {
  width: 1px !important;
  height: 20px !important;
  background: rgba(96,165,250,0.12) !important;
  margin: 0 6px !important;
  flex-shrink: 0 !important;
  align-self: center !important;
}

@media (max-width: 768px) {
  .nav-horizontal > li > a .nav-text { display: none !important; }
  .nav-horizontal > li > a i { font-size: 16px !important; }
  .nav-horizontal > li > a { padding: 7px 10px !important; border-radius: 8px !important; }
}

/* ================================================================
   CARD PATTERN  (spec §9)
================================================================ */
.card,
.dashboard-card,
.panel,
.well {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-subtle) !important;
  padding: 2rem !important;
  transition: transform var(--transition-med),
              box-shadow var(--transition-med),
              background var(--transition-med),
              border-color var(--transition-med) !important;
}
.card:hover,
.dashboard-card:hover,
.panel:hover,
.well:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--shadow-soft) !important;
}

/* ================================================================
   BOOTSTRAP COMPONENT OVERRIDES FOR DARK/LIGHT THEME
================================================================ */

/* Global text */
body { background: var(--bg) !important; color: var(--fg) !important; }
html.dark body { background: var(--bg) !important; color: var(--fg) !important; }
html.dark h1, html.dark h2, html.dark h3,
html.dark h4, html.dark h5, html.dark h6 { color: var(--fg) !important; }
html.dark p  { color: var(--fg-soft); }
html.dark hr { border-color: var(--border-subtle); }
html.dark .text-muted { color: var(--fg-muted) !important; }
html.dark .label { color: var(--fg) !important; }

/* Dark mode panel/card depth */
html.dark .panel,
html.dark .well,
html.dark .panel-default {
  background: var(--bg-elevated) !important;
  border-color: var(--border-subtle) !important;
}
html.dark .panel-default > .panel-heading {
  background: var(--bg-soft) !important;
  border-bottom-color: var(--border-subtle) !important;
  color: var(--fg) !important;
}
html.dark .panel-body {
  background: var(--bg-elevated) !important;
  color: var(--fg) !important;
}

/* Light mode explicit card shadow for depth */
html:not(.dark) .panel,
html:not(.dark) .well,
html:not(.dark) .card {
  box-shadow: 0 2px 12px rgba(13,31,64,0.09), 0 1px 3px rgba(13,31,64,0.06) !important;
  border-color: var(--border-subtle) !important;
}

/* Page layout */
.main {
  padding: 30px 40px !important;
  margin-left: 0 !important;
  width: 100% !important;
}
.col-sm-9.col-sm-offset-3.col-md-10.col-md-offset-2.main,
.col-md-10.col-md-offset-2.main {
  margin-left: 0 !important;
  float: none !important;
  width: 100% !important;
}
.page-header,
h1.page-header,
h2.page-header {
  border-bottom: 1px solid var(--border-subtle) !important;
  padding-bottom: 14px !important;
  margin-top: 0 !important;
  margin-bottom: 24px !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  color: var(--fg) !important;
  line-height: 1.3 !important;
}
@media (max-width: 480px) {
  .main { padding: 20px 16px !important; }
}

/* Inputs */
.form-control {
  background: var(--bg-elevated) !important;
  color: var(--fg) !important;
  border: 1.5px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px 14px !important;
  font-family: var(--font-main) !important;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}
.form-control:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
  outline: none !important;
}
.form-control::placeholder { color: var(--fg-muted) !important; }

/* Bootstrap buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)) !important;
  border-color: transparent !important;
  border-radius: var(--radius-pill) !important;
  font-weight: 500 !important;
  font-family: var(--font-main) !important;
  color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft) !important;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent)) !important;
  color: #fff !important;
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  border-color: transparent !important;
  border-radius: var(--radius-md) !important;
}
.btn-default {
  background: var(--bg-elevated) !important;
  color: var(--fg-soft) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
}
.btn-default:hover {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.btn-success {
  border-radius: var(--radius-md) !important;
}
.btn-warning {
  border-radius: var(--radius-md) !important;
}
.btn-info {
  border-radius: var(--radius-md) !important;
}

/* Tables */
.table { color: var(--fg); }
.table thead {
  background: var(--bg-soft) !important;
  color: var(--fg);
}
.table thead th {
  color: var(--fg-soft) !important;
  border-color: var(--border-subtle) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  border-top: none !important;
  font-weight: 700;
  padding: 11px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-soft); }
.table tbody td {
  color: var(--fg-soft);
  border-color: var(--border-subtle);
  vertical-align: middle;
  padding: 14px 16px;
}
html.dark .table-striped > tbody > tr:nth-child(odd) > td {
  background: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-content {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--fg) !important;
}
.modal-header {
  background: var(--bg-soft) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 18px 24px !important;
}
.modal-header .modal-title { color: var(--fg) !important; }
.modal-header .close {
  color: var(--fg-muted) !important;
  text-shadow: none !important;
  opacity: 0.8 !important;
}
.modal-header .close:hover { color: var(--fg) !important; opacity: 1 !important; }
.modal-body { padding: 24px !important; color: var(--fg) !important; }
.modal-footer {
  border-top: 1px solid var(--border-subtle) !important;
  padding: 16px 24px !important;
  background: var(--bg-soft) !important;
}

/* Alerts */
.alert {
  border-radius: var(--radius-md) !important;
  border: none !important;
  padding: 14px 18px !important;
}
.alert-info    { background: var(--accent-soft) !important; color: var(--accent) !important; }
.alert-danger  { background: var(--danger-soft)  !important; color: var(--danger) !important; }
.alert-success { background: rgba(34, 197, 94, 0.12) !important; color: #16a34a !important; }
.alert-warning { background: rgba(234, 179, 8, 0.12) !important; color: #a16207 !important; }
html.dark .alert-info {
  background: rgba(96, 165, 250, 0.1) !important;
  border-left: 3px solid rgba(96,165,250,0.5) !important;
  color: #93c5fd !important;
}
html.dark .alert-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border-left: 3px solid rgba(239,68,68,0.5) !important;
  color: #fca5a5 !important;
}
html.dark .alert-success {
  background: rgba(34, 197, 94, 0.1) !important;
  border-left: 3px solid rgba(34,197,94,0.5) !important;
  color: #4ade80 !important;
}
html.dark .alert-warning {
  background: rgba(234, 179, 8, 0.1) !important;
  border-left: 3px solid rgba(234,179,8,0.5) !important;
  color: #fde047 !important;
}

/* Nav tabs */
.nav-tabs { border-bottom: 2px solid var(--border-subtle) !important; }
.nav-tabs > li > a {
  color: var(--fg-muted) !important;
  border: none !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  font-weight: 500 !important;
  transition: color var(--transition-fast), background var(--transition-fast) !important;
}
.nav-tabs > li > a:hover {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border: none !important;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  background: var(--bg-elevated) !important;
  color: var(--accent) !important;
  border: none !important;
  border-bottom: 2px solid var(--accent) !important;
}

/* Dropdown menus */
.dropdown-menu {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-soft) !important;
}
.dropdown-menu > li > a {
  color: var(--fg-soft) !important;
  padding: 10px 16px !important;
  transition: background var(--transition-fast) !important;
}
.dropdown-menu > li > a:hover {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

/* Progress bar */
.progress {
  background: var(--bg-soft) !important;
  border-radius: var(--radius-pill) !important;
}

/* DataTables — both modes */
.dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--fg-soft) !important; }
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label { color: var(--fg-soft) !important; }
html.dark .dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--fg-soft) !important; }
html.dark .dataTables_wrapper .dataTables_info,
html.dark .dataTables_wrapper .dataTables_length label,
html.dark .dataTables_wrapper .dataTables_filter label { color: var(--fg-soft) !important; }
html.dark .dataTables_wrapper select,
html.dark .dataTables_wrapper input {
  background: var(--bg-elevated) !important;
  color: var(--fg) !important;
  border-color: var(--border-subtle) !important;
}

/* Select2 */
html.dark .select2-container .select2-choice,
html.dark .select2-container--default .select2-selection--single,
html.dark .select2-container--default .select2-selection--multiple {
  background: var(--bg-elevated) !important;
  color: var(--fg) !important;
  border-color: var(--border-subtle) !important;
}
html.dark .select2-drop,
html.dark .select2-dropdown {
  background: var(--bg-elevated) !important;
  border-color: var(--border-subtle) !important;
  color: var(--fg) !important;
}
html.dark .select2-results__option { color: var(--fg-soft) !important; }
html.dark .select2-results__option--highlighted[aria-selected] {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}
html.dark .select2-container--default .select2-selection__placeholder,
html.dark .select2-container .select2-chosen { color: var(--fg-muted) !important; }

/* SweetAlert2 */
html.dark .swal2-popup {
  background: var(--bg-elevated) !important;
  color: var(--fg) !important;
  border: 1px solid var(--border-subtle) !important;
}
html.dark .swal2-title  { color: var(--fg) !important; }
html.dark .swal2-content { color: var(--fg-soft) !important; }

/* Hide legacy Bootstrap navbar */
.navbar-inverse.navbar-fixed-top,
.navbar-default.navbar-fixed-top { display: none !important; }

/* Code/editor */
.tphish-editor {
  background: var(--bg-soft) !important;
  color: var(--fg) !important;
  border: 1px solid var(--border-subtle) !important;
}

/* ================================================================
   INLINE-STYLE OVERRIDES FOR DASHBOARD & BODY TEMPLATES
   (targets elements that use inline style="background:#fff|#2c3e50…")
================================================================ */

/* Chart overview card inner white wrapper */
html.dark #dashboard .overview-card-inner,
html.dark .chart-card-inner {
  background: var(--bg-elevated) !important;
  color: var(--fg) !important;
}
html.dark .chart-card-inner h4,
html.dark .chart-card-inner p { color: var(--fg) !important; }

/* Table wrappers used inline */
html.dark [style*="background: #fff"],
html.dark [style*="background:#fff"],
html.dark [style*='background: white'] {
  background: var(--bg-elevated) !important;
}
html.dark [style*="color: #2c3e50"] { color: var(--fg) !important; }
html.dark [style*="color: #6c757d"] { color: var(--fg-muted) !important; }
html.dark [style*="color: #8b92a8"] { color: var(--fg-muted) !important; }

/* ================================================================
   LOGIN / RESET-PASSWORD PAGE
================================================================ */
/* Login pages only have the top navbar — override body padding */
body:has(.login-page) {
  padding-top: 64px !important;
}

.login-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}

.login-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 2.5rem 2.5rem;
  width: 100%;
  max-width: 440px;
  transition: background var(--transition-med), border-color var(--transition-med);
}
html:not(.dark) .login-card {
  box-shadow: 0 8px 40px rgba(13,31,64,0.14), 0 2px 8px rgba(13,31,64,0.06);
}

.login-logo {
  display: block;
  margin: 0 auto 1.5rem;
  width: 72px;
  height: auto;
}

.login-heading {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 0.3rem;
}

.login-sub {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin: 0 0 2rem;
}

.login-field { margin-bottom: 1rem; }
.login-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-soft);
  margin-bottom: 6px;
}
.login-field .form-control { width: 100%; }

.login-forgot {
  display: block;
  text-align: right;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}
html[dir="rtl"] .login-forgot { text-align: left; }
.login-forgot:hover { color: var(--accent-strong); text-decoration: underline; }

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: var(--radius-pill);
}

@media (max-width: 480px) {
  .login-card { padding: 2rem 1.25rem; }
}

/* ================================================================
   CAMPAIGN RESULTS — DARK / LIGHT MODE FIXES
================================================================ */

/* Highcharts container: ensure it inherits theme background */
#timeline_chart,
#sent_chart,
#opened_chart,
#clicked_chart,
#submitted_data_chart,
#reported_chart {
  background: var(--bg-elevated) !important;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Remove the col-lg-1 spacer black bars in dark mode */
#campaignResults .row [class*="col-lg-1"],
#campaignResults .row [class*="col-md-1"] {
  background: transparent !important;
}

/* Chart row wrapper */
#campaignResults .row > [id$="_chart"] {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 4px;
}

/* Highcharts SVG text in dark mode */
html.dark .highcharts-title text,
html.dark .highcharts-axis-labels text,
html.dark .highcharts-legend-item text,
html.dark .highcharts-credits {
  fill: var(--fg-soft) !important;
  color: var(--fg-soft) !important;
}
html.dark .highcharts-axis-line,
html.dark .highcharts-tick,
html.dark .highcharts-grid-line { stroke: var(--border-subtle) !important; }
html.dark .highcharts-plot-background { fill: var(--bg-elevated) !important; }
html.dark .highcharts-background { fill: var(--bg-elevated) !important; }

/* Timeline expand row (well) */
.well { background: var(--bg-soft) !important; border-color: var(--border-subtle) !important; color: var(--fg) !important; }

/* Info button in results table */
.info-btn {
  border-radius: var(--radius-pill) !important;
  padding: 2px 8px !important;
  font-size: 12px !important;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.info-btn:hover { transform: scale(1.15); }

/* Geolocation tag in timeline */
html.dark .geo-tag {
  background: var(--bg-soft) !important;
  color: var(--fg-soft) !important;
}

/* SweetAlert info popup custom text */
html.dark .swal2-html-container code {
  background: var(--bg-soft) !important;
  color: var(--accent) !important;
  border-radius: 4px;
  padding: 1px 5px;
}
