/* ── Theme system using CSS custom properties ── */

:root {
  --theme-navbar-bg: #0d6efd;
  --theme-navbar-text: #fff;
  --theme-navbar-text-muted: rgba(255,255,255,.55);
  --theme-navbar-link-hover: rgba(255,255,255,.75);
  --theme-card-header-bg: #0d6efd;
  --theme-card-header-text: #fff;
  --theme-card-header-text-muted: rgba(255,255,255,.55);
  --theme-pill-active-bg: #0d6efd;
  --theme-pill-active-text: #fff;
  --theme-accent: #0d6efd;
  --theme-body-bg: #fff;
  --theme-body-text: #212529;
  --theme-card-bg: #fff;
  --theme-card-border: rgba(0,0,0,.125);
  --theme-table-hover: rgba(0,0,0,.035);
  --theme-muted: #6c757d;
  --theme-stripe-bg: #f8f9fa;
  --theme-badge-bg: #6c757d;
}

/* ── Aqua (swimming pool teal) ── */
[data-theme="aqua"] {
  --theme-navbar-bg: #0891b2;
  --theme-card-header-bg: #0891b2;
  --theme-pill-active-bg: #0891b2;
  --theme-accent: #0891b2;
}

/* ── Ocean (deep navy) ── */
[data-theme="ocean"] {
  --theme-navbar-bg: #1e3a5f;
  --theme-card-header-bg: #1e3a5f;
  --theme-pill-active-bg: #1e3a5f;
  --theme-accent: #2563eb;
}

/* ── Sunset (warm coral/orange) ── */
[data-theme="sunset"] {
  --theme-navbar-bg: #be4d25;
  --theme-card-header-bg: #be4d25;
  --theme-pill-active-bg: #be4d25;
  --theme-accent: #e16b3a;
}

/* ── Modern (light purple/lavender — inspired by modern SaaS dashboards) ── */
[data-theme="modern"] {
  --theme-navbar-bg: #f8f7fc;
  --theme-navbar-text: #3d3654;
  --theme-navbar-text-muted: rgba(61,54,84,.55);
  --theme-navbar-link-hover: #7c5cfc;
  --theme-card-header-bg: #7c5cfc;
  --theme-card-header-text: #fff;
  --theme-card-header-text-muted: rgba(255,255,255,.65);
  --theme-pill-active-bg: #7c5cfc;
  --theme-pill-active-text: #fff;
  --theme-accent: #7c5cfc;
  --theme-body-bg: #f4f2fa;
  --theme-body-text: #2d2640;
  --theme-card-bg: #fff;
  --theme-card-border: rgba(124,92,252,.12);
  --theme-table-hover: rgba(124,92,252,.04);
  --theme-muted: #8e87a0;
  --theme-stripe-bg: #f9f8fd;
  --theme-badge-bg: #7c5cfc;
  --theme-dropdown-bg: #fff;
  --theme-dropdown-border: rgba(124,92,252,.12);
  --theme-dropdown-text: #2d2640;
  --theme-dropdown-hover: #f4f2fa;
  --theme-sidebar-bg: #fff;
  --theme-sidebar-text: #3d3654;
  --theme-sidebar-active-bg: rgba(124,92,252,.1);
  --theme-sidebar-active-text: #7c5cfc;
  --theme-sidebar-hover-bg: rgba(124,92,252,.06);
}

/* ── MOVE-IT Leuven (navy + cyan, inspired by move-itleuven.be) ── */
[data-theme="move-itleuven"] {
  --theme-navbar-bg: #f4f8fb;
  --theme-navbar-text: #232F60;
  --theme-navbar-text-muted: rgba(35,47,96,.55);
  --theme-navbar-link-hover: #199DD9;
  --theme-card-header-bg: #232F60;
  --theme-card-header-text: #fff;
  --theme-card-header-text-muted: rgba(255,255,255,.55);
  --theme-pill-active-bg: #199DD9;
  --theme-pill-active-text: #fff;
  --theme-accent: #199DD9;
  --theme-body-bg: #f0f4f8;
  --theme-body-text: #232F60;
  --theme-card-bg: #fff;
  --theme-card-border: rgba(35,47,96,.12);
  --theme-table-hover: rgba(25,157,217,.06);
  --theme-muted: #6D6D6D;
  --theme-stripe-bg: #f4f8fb;
  --theme-badge-bg: #232F60;
  --theme-dropdown-bg: #fff;
  --theme-dropdown-border: rgba(35,47,96,.12);
  --theme-dropdown-text: #232F60;
  --theme-dropdown-hover: #f0f6fb;
  --theme-sidebar-bg: #fff;
  --theme-sidebar-text: #232F60;
  --theme-sidebar-active-bg: rgba(25,157,217,.12);
  --theme-sidebar-active-text: #199DD9;
  --theme-sidebar-hover-bg: rgba(25,157,217,.06);
}

/* MOVE-IT Leuven: light navbar with dark text (like modern) */
[data-theme="move-itleuven"] .navbar.navbar-themed {
  box-shadow: 0 1px 3px rgba(35,47,96,.1);
}
[data-theme="move-itleuven"] .navbar .nav-link,
[data-theme="move-itleuven"] .navbar .navbar-brand {
  color: var(--theme-navbar-text) !important;
}
[data-theme="move-itleuven"] .navbar .nav-link:hover {
  color: var(--theme-accent) !important;
}
[data-theme="move-itleuven"] .navbar .nav-link.active {
  color: var(--theme-accent) !important;
  font-weight: 600;
}
[data-theme="move-itleuven"] .navbar-toggler {
  border-color: rgba(35,47,96,.2);
}
[data-theme="move-itleuven"] .navbar-toggler-icon {
  filter: invert(0.5);
}

/* MOVE-IT Leuven: light sidebar */
[data-theme="move-itleuven"] .sidebar {
  background-color: var(--theme-sidebar-bg, #fff) !important;
  box-shadow: 1px 0 4px rgba(35,47,96,.08);
}
[data-theme="move-itleuven"] .sidebar .sidebar-brand {
  color: var(--theme-sidebar-text);
  border-bottom-color: rgba(25,157,217,.15);
}
[data-theme="move-itleuven"] .sidebar .sidebar-brand:hover {
  color: var(--theme-accent);
}
[data-theme="move-itleuven"] .sidebar .nav-link {
  color: var(--theme-sidebar-text) !important;
}
[data-theme="move-itleuven"] .sidebar .nav-link:hover {
  background-color: var(--theme-sidebar-hover-bg) !important;
  color: var(--theme-accent) !important;
}
[data-theme="move-itleuven"] .sidebar .nav-link.active {
  background-color: var(--theme-sidebar-active-bg) !important;
  color: var(--theme-sidebar-active-text) !important;
}
[data-theme="move-itleuven"] .sidebar .sidebar-divider {
  border-color: rgba(25,157,217,.1);
}
[data-theme="move-itleuven"] .sidebar .sidebar-heading {
  color: var(--theme-muted);
}
[data-theme="move-itleuven"] .sidebar-user {
  border-color: rgba(25,157,217,.1);
}
[data-theme="move-itleuven"] .sidebar-toggle,
[data-theme="move-itleuven"] .sidebar-toggle-mobile {
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

/* MOVE-IT Leuven: cards with shadow instead of border */
[data-theme="move-itleuven"] .card {
  border: none;
  box-shadow: 0 1px 6px rgba(35,47,96,.08);
  border-radius: 12px;
}
[data-theme="move-itleuven"] .card-header {
  border-radius: 12px 12px 0 0 !important;
}
[data-theme="move-itleuven"] .card-header.card-header-themed {
  border-radius: 12px 12px 0 0 !important;
}

/* MOVE-IT Leuven: rounded pills */
[data-theme="move-itleuven"] .nav-pills .nav-link {
  border-radius: 20px;
}

/* MOVE-IT Leuven: rounded inputs */
[data-theme="move-itleuven"] .form-control,
[data-theme="move-itleuven"] .form-select {
  border-radius: 8px;
  border-color: rgba(25,157,217,.2);
}
[data-theme="move-itleuven"] .form-control:focus,
[data-theme="move-itleuven"] .form-select:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 .25rem rgba(25,157,217,.15);
}

/* MOVE-IT Leuven: buttons */
[data-theme="move-itleuven"] .btn-primary {
  border-radius: 8px;
}
[data-theme="move-itleuven"] .btn-outline-secondary {
  border-radius: 8px;
  border-color: rgba(25,157,217,.2);
  color: var(--theme-body-text);
}
[data-theme="move-itleuven"] .btn-outline-secondary:hover {
  background-color: rgba(25,157,217,.08);
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

/* MOVE-IT Leuven: badges */
[data-theme="move-itleuven"] .badge.bg-secondary {
  background-color: var(--theme-accent) !important;
  border-radius: 12px;
}

/* ── Dark ── */
[data-theme="dark"] {
  --theme-navbar-bg: #1a1d21;
  --theme-navbar-text: #e0e0e0;
  --theme-navbar-text-muted: rgba(255,255,255,.45);
  --theme-card-header-bg: #2b3035;
  --theme-card-header-text: #e0e0e0;
  --theme-card-header-text-muted: rgba(255,255,255,.45);
  --theme-pill-active-bg: #0d6efd;
  --theme-pill-active-text: #fff;
  --theme-accent: #4d94ff;
  --theme-body-bg: #121416;
  --theme-body-text: #dee2e6;
  --theme-card-bg: #1e2125;
  --theme-card-border: rgba(255,255,255,.1);
  --theme-table-hover: rgba(255,255,255,.04);
  --theme-muted: #9ca3af;
  --theme-stripe-bg: #1a1d21;
  --theme-badge-bg: #495057;
  --theme-dropdown-bg: #2b3035;
  --theme-dropdown-border: #495057;
  --theme-dropdown-text: #dee2e6;
  --theme-dropdown-hover: #343a40;
}

/* ── Apply theme variables to components ── */

body {
  background-color: var(--theme-body-bg);
  color: var(--theme-body-text);
}

/* Navbar — only override background; navbar-dark handles text colors */
.navbar.navbar-themed {
  background-color: var(--theme-navbar-bg) !important;
}

/* Dropdown menus (all themes) */
.dropdown-menu {
  background-color: var(--theme-dropdown-bg, #fff);
  border-color: var(--theme-dropdown-border, rgba(0,0,0,.15));
}
.dropdown-item {
  color: var(--theme-dropdown-text, #212529);
}
.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--theme-dropdown-hover, #e9ecef);
  color: var(--theme-dropdown-text, #212529);
}
.dropdown-header {
  color: var(--theme-muted);
}

/* Nav pills */
.nav-pills .nav-link.active {
  background-color: var(--theme-pill-active-bg) !important;
  color: var(--theme-pill-active-text) !important;
}

/* Cards */
.card {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-card-border);
}
.card-header.card-header-themed {
  background-color: var(--theme-card-header-bg) !important;
  color: var(--theme-card-header-text) !important;
}
.card-header-themed a.text-white {
  color: var(--theme-card-header-text) !important;
}
.card-header-themed .text-white-50 {
  color: var(--theme-card-header-text-muted) !important;
}
.card-footer {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-card-border);
}

/* Tables */
.table {
  color: var(--theme-body-text);
  --bs-table-hover-bg: var(--theme-table-hover);
  --bs-table-bg: transparent;
}
.table > tbody > tr > td a {
  color: var(--theme-accent);
}
.table > thead {
  color: var(--theme-body-text);
}

/* Striped rows */
.bg-light {
  background-color: var(--theme-stripe-bg) !important;
}

/* Badges */
.badge.bg-secondary {
  background-color: var(--theme-badge-bg) !important;
}

/* Text */
.text-muted {
  color: var(--theme-muted) !important;
}

/* ── Dark mode comprehensive overrides ── */

/* Card headers (non-themed) */
[data-theme="dark"] .card-header {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-card-border);
  color: var(--theme-body-text);
}

/* Card body */
[data-theme="dark"] .card-body {
  color: var(--theme-body-text);
}

/* Tables — force dark bg on all table elements */
[data-theme="dark"] .table,
[data-theme="dark"] .table thead,
[data-theme="dark"] .table tbody,
[data-theme="dark"] .table tr,
[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
  color: #dee2e6 !important;
  border-color: rgba(255,255,255,.1) !important;
}
[data-theme="dark"] .table > thead {
  border-bottom-color: rgba(255,255,255,.15) !important;
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(255,255,255,.04) !important;
  color: #dee2e6 !important;
}

/* Nav tabs */
[data-theme="dark"] .nav-tabs {
  border-bottom-color: rgba(255,255,255,.1);
}
[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--theme-muted);
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
  border-color: rgba(255,255,255,.1) rgba(255,255,255,.1) transparent;
  color: var(--theme-body-text);
}
[data-theme="dark"] .nav-tabs .nav-link.active {
  background-color: var(--theme-card-bg);
  border-color: rgba(255,255,255,.1) rgba(255,255,255,.1) var(--theme-card-bg);
  color: var(--theme-body-text);
}

/* Nav pills inactive */
[data-theme="dark"] .nav-pills .nav-link:not(.active) {
  color: var(--theme-body-text);
}

/* Tab content */
[data-theme="dark"] .tab-content,
[data-theme="dark"] .tab-pane {
  color: var(--theme-body-text);
}

/* Headings */
[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: var(--theme-body-text);
}

/* Bootstrap text-body override */
[data-theme="dark"] .text-body {
  color: var(--theme-body-text) !important;
}
[data-theme="dark"] .text-dark {
  color: var(--theme-body-text) !important;
}

/* Definition lists */
[data-theme="dark"] dt {
  color: var(--theme-muted);
}
[data-theme="dark"] dd {
  color: var(--theme-body-text);
}

/* Breadcrumbs */
[data-theme="dark"] .breadcrumb {
  color: var(--theme-body-text);
}
[data-theme="dark"] .breadcrumb-item a {
  color: var(--theme-accent);
}
[data-theme="dark"] .breadcrumb-item.active {
  color: var(--theme-muted);
}
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
  color: var(--theme-muted);
}

/* Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #2b3035;
  border-color: #495057;
  color: #dee2e6;
}
[data-theme="dark"] .form-control::placeholder {
  color: #6c757d;
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #2b3035;
  border-color: var(--theme-accent);
  color: #dee2e6;
  box-shadow: 0 0 0 .25rem rgba(77,148,255,.25);
}
[data-theme="dark"] .form-label,
[data-theme="dark"] .form-check-label {
  color: var(--theme-body-text);
}

/* Dropdown active & divider */
.dropdown-item.active {
  background-color: var(--theme-accent);
  color: #fff;
}
[data-theme="dark"] .dropdown-divider {
  border-color: #495057;
}

/* Alerts */
[data-theme="dark"] .alert-warning {
  background-color: #332701;
  border-color: #664d03;
  color: #ffda6a;
}
[data-theme="dark"] .alert-info {
  background-color: #032830;
  border-color: #055160;
  color: #6edff6;
}
[data-theme="dark"] .alert-success {
  background-color: #051b11;
  border-color: #0f5132;
  color: #75b798;
}
[data-theme="dark"] .alert-danger {
  background-color: #2c0b0e;
  border-color: #842029;
  color: #ea868f;
}

/* Buttons */
[data-theme="dark"] .btn-outline-secondary {
  color: #adb5bd;
  border-color: #495057;
}
[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: #495057;
  color: #fff;
}
[data-theme="dark"] .btn-outline-danger {
  color: #ea868f;
  border-color: #842029;
}
[data-theme="dark"] .btn-outline-danger:hover {
  background-color: #842029;
  color: #fff;
}
[data-theme="dark"] .btn-primary {
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
}

/* Member row border */
[data-theme="dark"] .member-row + .member-row {
  border-top-color: rgba(255,255,255,.08);
}

/* List groups */
[data-theme="dark"] .list-group-item {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-card-border);
  color: var(--theme-body-text);
}

/* Modal */
[data-theme="dark"] .modal-content {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-card-border);
  color: var(--theme-body-text);
}

/* Pagination */
[data-theme="dark"] .page-link {
  background-color: var(--theme-card-bg);
  border-color: var(--theme-card-border);
  color: var(--theme-body-text);
}

/* Confirm delete card header */
[data-theme="dark"] .card-header.bg-danger {
  background-color: #842029 !important;
}

/* Links */
a:not(.nav-link):not(.navbar-brand):not(.dropdown-item):not(.btn):not(.text-decoration-none) {
  color: var(--theme-accent);
}

/* Primary buttons for all themes */
.btn-primary {
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
}
.btn-primary:hover {
  filter: brightness(1.1);
}

/* ── Modern theme overrides ─────────────────────── */

/* Modern: light navbar needs dark text */
[data-theme="modern"] .navbar.navbar-themed {
  box-shadow: 0 1px 3px rgba(124,92,252,.08);
}
[data-theme="modern"] .navbar .nav-link,
[data-theme="modern"] .navbar .navbar-brand {
  color: var(--theme-navbar-text) !important;
}
[data-theme="modern"] .navbar .nav-link:hover {
  color: var(--theme-accent) !important;
}
[data-theme="modern"] .navbar .nav-link.active {
  color: var(--theme-accent) !important;
  font-weight: 600;
}
[data-theme="modern"] .navbar-toggler {
  border-color: rgba(61,54,84,.2);
}
[data-theme="modern"] .navbar-toggler-icon {
  filter: invert(0.5);
}

/* Modern: light sidebar */
[data-theme="modern"] .sidebar {
  background-color: var(--theme-sidebar-bg, #fff) !important;
  box-shadow: 1px 0 4px rgba(124,92,252,.08);
}
[data-theme="modern"] .sidebar .sidebar-brand {
  color: var(--theme-sidebar-text);
  border-bottom-color: rgba(124,92,252,.1);
}
[data-theme="modern"] .sidebar .sidebar-brand:hover {
  color: var(--theme-accent);
}
[data-theme="modern"] .sidebar .nav-link {
  color: var(--theme-sidebar-text) !important;
}
[data-theme="modern"] .sidebar .nav-link:hover {
  background-color: var(--theme-sidebar-hover-bg) !important;
  color: var(--theme-accent) !important;
}
[data-theme="modern"] .sidebar .nav-link.active {
  background-color: var(--theme-sidebar-active-bg) !important;
  color: var(--theme-sidebar-active-text) !important;
}
[data-theme="modern"] .sidebar .sidebar-divider {
  border-color: rgba(124,92,252,.1);
}
[data-theme="modern"] .sidebar .sidebar-heading {
  color: var(--theme-muted);
}
[data-theme="modern"] .sidebar-user {
  border-color: rgba(124,92,252,.1);
}
[data-theme="modern"] .sidebar-toggle,
[data-theme="modern"] .sidebar-toggle-mobile {
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

/* Modern: cards get subtle shadow instead of border */
[data-theme="modern"] .card {
  border: none;
  box-shadow: 0 1px 6px rgba(124,92,252,.08);
  border-radius: 12px;
}
[data-theme="modern"] .card-header {
  border-radius: 12px 12px 0 0 !important;
}
[data-theme="modern"] .card-header.card-header-themed {
  border-radius: 12px 12px 0 0 !important;
}

/* Modern: rounded pills */
[data-theme="modern"] .nav-pills .nav-link {
  border-radius: 20px;
}

/* Modern: rounded inputs */
[data-theme="modern"] .form-control,
[data-theme="modern"] .form-select {
  border-radius: 8px;
  border-color: rgba(124,92,252,.2);
}
[data-theme="modern"] .form-control:focus,
[data-theme="modern"] .form-select:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 .25rem rgba(124,92,252,.15);
}

/* Modern: buttons */
[data-theme="modern"] .btn-primary {
  border-radius: 8px;
}
[data-theme="modern"] .btn-outline-secondary {
  border-radius: 8px;
  border-color: rgba(124,92,252,.2);
  color: var(--theme-body-text);
}
[data-theme="modern"] .btn-outline-secondary:hover {
  background-color: rgba(124,92,252,.08);
  border-color: var(--theme-accent);
  color: var(--theme-accent);
}

/* Modern: badges */
[data-theme="modern"] .badge.bg-secondary {
  background-color: var(--theme-accent) !important;
  border-radius: 12px;
}
