/* Fooodis Admin Custom Theme
   Modern light/dark UI for the Laravel admin dashboard
*/

/* =========================
   Color system
   ========================= */
:root {
  --bg-body: #e2e8f0;
  --bg-header: #f1f5f9;
  --bg-sidebar: #f1f5f9;
  --bg-card: #f8fafc;
  --bg-card-soft: #e2e8f0;
  --bg-input: #ffffff;

  --text-primary: #1d2029;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #6366f1;
  --primary-soft: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f97316;
  --info: #0ea5e9;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.12);
}

body.dark-mode {
  --bg-body: #1d2029;
  --bg-header: #1d2029;
  --bg-sidebar: #10131a;
  --bg-card: #292d33;
  --bg-card-soft: #342866;
  --bg-input: #292d33;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.86);
  --text-muted: rgba(255, 255, 255, 0.65);

  --border-subtle: rgba(152, 128, 255, 0.22);
  --border-strong: rgba(152, 128, 255, 0.38);

  --primary: #9880ff;
  --primary-soft: #342866;
  --success: #c7d037;
  --warning: #e8f24c;
  --info: #9880ff;

  --shadow-soft: 0 14px 35px rgba(0, 0, 0, 0.35);
}

body.dark-mode.dashboard-theme {
  --bg-body: #1d2029;
  --bg-header: #1d2029;
  --bg-sidebar: #10131a;
  --bg-card: #292d33;
  --bg-card-soft: #342866;
  --bg-input: #292d33;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.86);
  --text-muted: rgba(255, 255, 255, 0.65);

  --border-subtle: rgba(152, 128, 255, 0.22);
  --border-strong: rgba(152, 128, 255, 0.38);

  --primary: #9880ff;
  --primary-soft: #342866;
  --success: #c7d037;
  --warning: #e8f24c;
  --info: #9880ff;

  --shadow-soft: 0 14px 35px rgba(0, 0, 0, 0.35);
}

/* =========================
   Base styles
   ========================= */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-secondary);
  font-family: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  color: var(--text-primary);
}

.text-muted,
small,
.small {
  color: var(--text-muted) !important;
}

/* =========================
   Layout: header & main
   ========================= */
.header {
  background: var(--bg-header) !important;
  background-image: none !important;
  border: 0;
  padding-top: 1.5rem !important;
  padding-bottom: 1rem !important;
  min-height: 80px;
  position: relative;
}

.header .container-fluid,
.header .row,
.header .col {
  background: transparent !important;
}

/* Critical fix: navbar-top positioning */
.navbar-top {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  position: relative !important;
  top: auto !important;
  margin-top: 0 !important;
}

/* Fix navbar-top right-side elements - prevent jumping out of page */
.navbar-top .navbar-nav {
  position: relative !important;
  top: auto !important;
  margin-top: 0 !important;
}

.navbar-top .navbar-nav.align-items-center {
  flex-wrap: nowrap !important;
  gap: 0.5rem;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.navbar-top .navbar-nav.align-items-center .nav-item {
  margin: 0 0.25rem !important;
  flex-shrink: 0;
  position: relative !important;
  top: auto !important;
}

/* Fix buttons in header - prevent jumping */
.navbar-top .btn,
.header .btn {
  white-space: nowrap;
  margin: 0 0.15rem !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.78rem !important;
  position: relative !important;
  top: auto !important;
}

/* Ensure proper spacing for toggle and user menu */
.navbar-top .nav-item.dropdown {
  position: relative !important;
  top: auto !important;
}

/* Fix the user avatar/dropdown */
.navbar-top .avatar {
  position: relative !important;
  top: auto !important;
}

/* Fix header title spacing */
.header h2,
.header h6,
.header .text-white {
  margin-bottom: 0.25rem;
}

/* Ensure header row aligns items properly */
.header .row {
  align-items: center !important;
}

/* Fix any negative margins that might push elements up */
.header .container-fluid.mt--7,
.header .container-fluid.mt--8,
.header .container-fluid.mt--9 {
  margin-top: 0 !important;
}

/* CRITICAL: Fix navbar-main (top navbar) positioning without white gap */
#navbar-main,
.navbar-top#navbar-main {
  position: relative !important;
  top: 0 !important;
  margin-top: 0 !important;
  padding-top: 1.75rem !important;
  padding-bottom: 0.75rem !important;
  background-color: var(--bg-header) !important;
}

body.dark-mode.dashboard-theme #navbar-main,
body.dark-mode.dashboard-theme .navbar-top#navbar-main {
  background-color: var(--bg-header) !important;
}

/* Fix the navbar container */
#navbar-main .container-fluid {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Fix the right-side ul in navbar */
#navbar-main .navbar-nav.align-items-center {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

#navbar-main .navbar-nav.align-items-center > li,
#navbar-main .navbar-nav.align-items-center > .nav-item {
  display: flex !important;
  align-items: center !important;
  margin: 0 0.35rem !important;
}

/* Fix avatar positioning */
#navbar-main .avatar,
#navbar-main .avatar-sm {
  position: relative !important;
  top: 0 !important;
}

/* Fix media body in navbar */
#navbar-main .media,
#navbar-main .media-body {
  display: flex !important;
  align-items: center !important;
}

.main-content {
  background-color: transparent !important;
  min-height: 100vh;
}

body.dark-mode .main-content {
  background-color: var(--bg-body) !important;
}

html.dark-mode,
html.dark-mode body,
.dark-mode,
.dark-mode body {
  background: var(--bg-body) !important;
  background-image: none !important;
}

html.dark-mode .main-content,
.dark-mode .main-content {
  background: var(--bg-body) !important;
  background-image: none !important;
}

.container-fluid,
.container-fluid.mt--7,
.container-fluid.mt--8,
.container-fluid.mt--9 {
  background-color: transparent !important;
}

body.dark-mode .bg-gradient-default,
body.dark-mode .bg-gradient-primary,
body.dark-mode .bg-gradient-info,
body.dark-mode .bg-gradient-dark {
  background: var(--bg-body) !important;
  background-image: none !important;
}

html.dark-mode .bg-gradient-default,
html.dark-mode .bg-gradient-primary,
html.dark-mode .bg-gradient-info,
html.dark-mode .bg-gradient-dark,
.dark-mode .bg-gradient-default,
.dark-mode .bg-gradient-primary,
.dark-mode .bg-gradient-info,
.dark-mode .bg-gradient-dark {
  background: var(--bg-body) !important;
  background-image: none !important;
}

body.dark-mode .bg-default {
  background: var(--bg-body) !important;
}

html.dark-mode .bg-default,
.dark-mode .bg-default {
  background: var(--bg-body) !important;
}

body.dark-mode .header.bg-gradient-default,
body.dark-mode .header.bg-gradient-primary,
body.dark-mode .header.bg-gradient-info,
body.dark-mode .header.bg-gradient-dark,
body.dark-mode .header.bg-default {
  background: var(--bg-body) !important;
  background-image: none !important;
}

html.dark-mode .header.bg-gradient-default,
html.dark-mode .header.bg-gradient-primary,
html.dark-mode .header.bg-gradient-info,
html.dark-mode .header.bg-gradient-dark,
html.dark-mode .header.bg-default,
.dark-mode .header.bg-gradient-default,
.dark-mode .header.bg-gradient-primary,
.dark-mode .header.bg-gradient-info,
.dark-mode .header.bg-gradient-dark,
.dark-mode .header.bg-default {
  background: var(--bg-body) !important;
  background-image: none !important;
}

body.dark-mode .header .mask.bg-gradient-default,
body.dark-mode .header .mask.bg-gradient-primary,
body.dark-mode .header .mask.bg-gradient-info,
body.dark-mode .header .mask.bg-gradient-dark,
body.dark-mode .header .mask.bg-default {
  background: var(--bg-body) !important;
  background-image: none !important;
  opacity: 1 !important;
}

html.dark-mode .header .mask.bg-gradient-default,
html.dark-mode .header .mask.bg-gradient-primary,
html.dark-mode .header .mask.bg-gradient-info,
html.dark-mode .header .mask.bg-gradient-dark,
html.dark-mode .header .mask.bg-default,
.dark-mode .header .mask.bg-gradient-default,
.dark-mode .header .mask.bg-gradient-primary,
.dark-mode .header .mask.bg-gradient-info,
.dark-mode .header .mask.bg-gradient-dark,
.dark-mode .header .mask.bg-default {
  background: var(--bg-body) !important;
  background-image: none !important;
  opacity: 1 !important;
}

/* =========================
   Sidebar
   ========================= */
.navbar-vertical,
.navbar-vertical.navbar-expand-md,
#sidenav-main {
  background-color: var(--bg-sidebar) !important;
  border-right: none !important;
  box-shadow: none !important;
}

.navbar-vertical .navbar-brand {
  padding: 1.25rem 1.5rem 1rem;
}

.navbar-vertical .navbar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  margin: 0.15rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-primary) !important; /* base: readable on light; dark-mode overrides below */
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.navbar-vertical .navbar-nav .nav-link i {
  font-size: 0.95rem;
  color: rgba(148, 163, 184, 0.9) !important;
}

.navbar-vertical .navbar-nav .nav-link:hover {
  background-color: rgba(148, 163, 184, 0.16) !important;
  color: #e5e7eb !important;
  transform: translateX(2px);
}

.navbar-vertical .navbar-nav .nav-link.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 25px rgba(232, 242, 76, 0.22);
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link.active {
  border-left: 3px solid var(--warning) !important;
}

.navbar-vertical .navbar-nav .nav-link.active i {
  color: #ffffff !important;
}

.navbar-vertical .navbar-nav .nav-link .nav-link-text {
  flex: 1;
}

body.sidebar-collapsed .navbar-vertical.fixed-left,
body.sidebar-collapsed #sidenav-main {
  width: 72px !important;
  max-width: 72px !important;
  min-width: 72px !important;
  overflow-x: hidden !important;
}

body.sidebar-collapsed .navbar-vertical .navbar-collapse {
  overflow: hidden !important;
}

body.sidebar-collapsed .navbar-vertical .navbar-brand-img {
  max-height: 28px;
  width: auto;
}

body.sidebar-collapsed .navbar-vertical .navbar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem !important;
}

/* Hide user profile section text */
body.sidebar-collapsed .navbar-vertical .media-body,
body.sidebar-collapsed .navbar-vertical .media .media-body,
body.sidebar-collapsed .navbar-vertical .sidenav-header .media-body,
body.sidebar-collapsed .navbar-vertical .dropdown-toggle span,
body.sidebar-collapsed .navbar-vertical .nav-link-text,
body.sidebar-collapsed .navbar-vertical .navbar-heading,
body.sidebar-collapsed .navbar-vertical hr.my-3,
body.sidebar-collapsed .navbar-vertical h6,
body.sidebar-collapsed .navbar-vertical small,
body.sidebar-collapsed .navbar-vertical .copyright {
  display: none !important;
}

/* Center user avatar in collapsed mode */
body.sidebar-collapsed .navbar-vertical .media {
  justify-content: center !important;
}

body.sidebar-collapsed .navbar-vertical .media .avatar {
  margin-right: 0 !important;
}

/* Nav links: center icons, hide ALL text using font-size trick */
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link {
  justify-content: center !important;
  text-align: center;
  padding: 0.65rem 0.5rem !important;
  margin: 0.15rem 0.5rem;
  font-size: 0 !important;
  line-height: 0 !important;
}

body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link > span,
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link .nav-link-text,
body.sidebar-collapsed .navbar-vertical .nav-link > span:not(.badge):not(.blob) {
  display: none !important;
}

body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link i,
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link .ni,
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link [class^="ni-"],
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link [class*=" ni-"],
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link [class^="fa-"],
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav-link [class*=" fa-"] {
  font-size: 1.15rem !important;
  line-height: 1.5 !important;
  margin-right: 0 !important;
}

/* Subcategory dropdowns in collapsed mode: hide, show as flyout on hover */
body.sidebar-collapsed .navbar-vertical .nav-item > .collapse,
body.sidebar-collapsed .navbar-vertical .nav-item > .nav.nav-sm,
body.sidebar-collapsed .navbar-vertical .navbar-nav .nav.nav-sm {
  display: none !important;
}

body.sidebar-collapsed .navbar-vertical .nav-item {
  position: relative;
}

body.sidebar-collapsed .navbar-vertical .nav-item:hover > .collapse,
body.sidebar-collapsed .navbar-vertical .nav-item:hover > .nav.nav-sm {
  display: block !important;
  position: absolute;
  left: 72px;
  top: 0;
  background: var(--bg-sidebar, #1a1f2e);
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 0.5rem 0;
  min-width: 180px;
  z-index: 1050;
}

body.sidebar-collapsed .navbar-vertical .nav-item:hover > .collapse .nav-link,
body.sidebar-collapsed .navbar-vertical .nav-item:hover > .nav.nav-sm .nav-link {
  justify-content: flex-start !important;
  padding: 0.5rem 1rem !important;
}

body.sidebar-collapsed .navbar-vertical .nav-item:hover > .collapse .nav-link span,
body.sidebar-collapsed .navbar-vertical .nav-item:hover > .nav.nav-sm .nav-link span {
  display: inline !important;
}

/* Hide dropdown arrows in collapsed mode */
body.sidebar-collapsed .navbar-vertical [data-toggle="collapse"]::after {
  display: none !important;
}

body.sidebar-collapsed .navbar-vertical.fixed-left ~ .main-content {
  margin-left: 72px !important;
}

body.sidebar-collapsed .navbar-vertical.fixed-left ~ .main-content .navbar-top {
  left: 72px !important;
}

body.sidebar-collapsed .navbar-vertical.fixed-right ~ .main-content {
  margin-right: 72px !important;
  margin-left: 0 !important;
}

body.sidebar-collapsed .navbar-vertical.fixed-right ~ .main-content .navbar-top {
  right: 72px !important;
  left: 0 !important;
}

.navbar-vertical .navbar-nav .dropdown-menu {
  background-color: var(--bg-card) !important;
  border-radius: var(--radius-md);
  border-color: var(--border-subtle);
}

.navbar-vertical .copyright,
.navbar-vertical small {
  color: var(--text-muted) !important;
}

/* Light theme: make sidebar items darker for visibility on white */
body:not(.dark-mode) .navbar-vertical,
body:not(.dark-mode) #sidenav-main {
  background-color: #ffffff !important;
}

body:not(.dark-mode) .navbar-vertical .navbar-nav .nav-link {
  color: var(--text-primary) !important; /* main text */
}

body:not(.dark-mode) .navbar-vertical .navbar-nav .nav-link i {
  color: #6b7280 !important; /* icons */
}

body:not(.dark-mode) .navbar-vertical .navbar-nav .nav-link:hover {
  background-color: rgba(15, 23, 42, 0.05) !important;
  color: #020617 !important;
}

body:not(.dark-mode) .navbar-vertical .navbar-nav .nav-link.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
}

/* Dark theme: override sidebar colors for contrast on dark background */
body.dark-mode .navbar-vertical,
body.dark-mode #sidenav-main {
  background-color: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border-subtle) !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link {
  color: var(--text-secondary) !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link i {
  color: var(--text-muted) !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link:hover {
  background-color: transparent !important;
  color: var(--warning) !important;
  transform: none !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link:hover i {
  color: var(--warning) !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link.active {
  background: transparent !important;
  color: var(--warning) !important;
  box-shadow: none !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link.active i {
  color: var(--warning) !important;
}

body.dark-mode .navbar-vertical .navbar-nav .nav-link.active:before {
  content: none !important;
  border-left: 0 !important;
}

body.dark-mode.dashboard-theme .navbar-vertical .navbar-nav .nav-link.active {
  background: transparent !important;
  color: var(--warning) !important;
  box-shadow: none !important;
}

body.dark-mode.dashboard-theme .navbar-vertical .navbar-nav .nav-link:hover {
  background-color: transparent !important;
  color: var(--warning) !important;
  transform: none !important;
}

body.dark-mode.dashboard-theme .navbar-vertical .navbar-nav .nav-link:hover i {
  color: var(--warning) !important;
}

body.dark-mode.dashboard-theme a {
  color: #9880ff;
}

body.dark-mode.dashboard-theme a:hover {
  color: #e8f24c;
}

body.dark-mode.dashboard-theme .bg-gradient-default,
body.dark-mode.dashboard-theme .bg-gradient-primary {
  background: var(--bg-body) !important;
  background-image: none !important;
}

body.dark-mode.dashboard-theme .icon-shape.bg-yellow {
  background-color: #e8f24c !important;
  color: #1d2029 !important;
}

body.dark-mode.dashboard-theme .icon-shape.bg-success {
  background-color: #c7d037 !important;
  color: #1d2029 !important;
}

body.dark-mode.dashboard-theme .icon-shape.bg-warning {
  background-color: #e8f24c !important;
  color: #1d2029 !important;
}

body.dark-mode .icon-shape.bg-info,
body.dark-mode.dashboard-theme .icon-shape.bg-info {
  background-color: #9880ff !important;
  color: #1d2029 !important;
}

body.dark-mode .icon-shape.bg-danger,
body.dark-mode.dashboard-theme .icon-shape.bg-danger {
  background-color: #342866 !important;
  color: #ffffff !important;
}

/* Restore gradients for icon shapes in dark mode (analytics dashboard) */
body.dark-mode .icon-shape.bg-gradient-primary,
body.dark-mode.dashboard-theme .icon-shape.bg-gradient-primary {
    background: linear-gradient(87deg, #5e72e4 0, #825ee4 100%) !important;
    color: #ffffff !important;
}

body.dark-mode .icon-shape.bg-gradient-success,
body.dark-mode.dashboard-theme .icon-shape.bg-gradient-success {
    background: linear-gradient(87deg, #2dce89 0, #2dcecc 100%) !important;
    color: #ffffff !important;
}

body.dark-mode .icon-shape.bg-gradient-info,
body.dark-mode.dashboard-theme .icon-shape.bg-gradient-info {
    background: linear-gradient(87deg, #11cdef 0, #1171ef 100%) !important;
    color: #ffffff !important;
}

body.dark-mode .icon-shape.bg-gradient-danger,
body.dark-mode.dashboard-theme .icon-shape.bg-gradient-danger {
    background: linear-gradient(87deg, #f5365c 0, #f56036 100%) !important;
    color: #ffffff !important;
}

body.dark-mode .icon-shape.bg-gradient-warning,
body.dark-mode.dashboard-theme .icon-shape.bg-gradient-warning {
    background: linear-gradient(87deg, #fb6340 0, #fbb140 100%) !important;
    color: #ffffff !important;
}

/* Restore text-white behavior ONLY for these specific gradient backgrounds */
body.dark-mode .icon-shape[class*="bg-gradient-"] i,
body.dark-mode .icon-shape[class*="bg-gradient-"] svg,
body.dark-mode.dashboard-theme .icon-shape[class*="bg-gradient-"] i,
body.dark-mode.dashboard-theme .icon-shape[class*="bg-gradient-"] svg {
    color: #ffffff !important;
}

/* Ensure Font Awesome icons render correctly inside badges */
.icon-shape i.fas,
.icon-shape i.fa-solid {
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  font-style: normal !important;
}

.icon-shape i.far,
.icon-shape i.fa-regular {
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 400 !important;
  font-style: normal !important;
}

.icon-shape i.fab,
.icon-shape i.fa-brands {
  font-family: "Font Awesome 5 Brands" !important;
  font-weight: 400 !important;
  font-style: normal !important;
}

.icon-shape i.fa {
  font-family: "FontAwesome" !important;
  font-weight: normal !important;
  font-style: normal !important;
}

.icon-shape i.ni,
.icon-shape .ni,
.icon-shape i.ni::before,
.icon-shape .ni::before {
  font-family: "NucleoIcons" !important;
  font-weight: normal !important;
  font-style: normal !important;
}

/* Fix invisible icons in stats cards: force dark icon color on bright backgrounds */
body.dark-mode .icon-shape.bg-yellow i,
body.dark-mode .icon-shape.bg-yellow svg,
body.dark-mode .icon-shape.bg-success i,
body.dark-mode .icon-shape.bg-success svg,
body.dark-mode .icon-shape.bg-warning i,
body.dark-mode .icon-shape.bg-warning svg,
body.dark-mode .icon-shape.bg-info i,
body.dark-mode .icon-shape.bg-info svg,
body.dark-mode.dashboard-theme .icon-shape.bg-yellow i,
body.dark-mode.dashboard-theme .icon-shape.bg-yellow svg,
body.dark-mode.dashboard-theme .icon-shape.bg-success i,
body.dark-mode.dashboard-theme .icon-shape.bg-success svg,
body.dark-mode.dashboard-theme .icon-shape.bg-warning i,
body.dark-mode.dashboard-theme .icon-shape.bg-warning svg,
body.dark-mode.dashboard-theme .icon-shape.bg-info i,
body.dark-mode.dashboard-theme .icon-shape.bg-info svg {
    color: #1d2029 !important;
}

/* Ensure the text-white class doesn't override it */
body.dark-mode .icon-shape.text-white i,
body.dark-mode .icon-shape.text-white svg,
body.dark-mode.dashboard-theme .icon-shape.text-white i,
body.dark-mode.dashboard-theme .icon-shape.text-white svg {
    color: #1d2029 !important;
}

body.dark-mode .icon-shape i.ni,
body.dark-mode .icon-shape .ni,
body.dark-mode .icon-shape i.ni::before,
body.dark-mode .icon-shape .ni::before,
html.dark-mode .icon-shape i.ni,
html.dark-mode .icon-shape .ni,
html.dark-mode .icon-shape i.ni::before,
html.dark-mode .icon-shape .ni::before,
.dark-mode .icon-shape i.ni,
.dark-mode .icon-shape .ni,
.dark-mode .icon-shape i.ni::before,
.dark-mode .icon-shape .ni::before,
body.dark-mode.dashboard-theme .icon-shape i.ni,
body.dark-mode.dashboard-theme .icon-shape .ni,
body.dark-mode.dashboard-theme .icon-shape i.ni::before,
body.dark-mode.dashboard-theme .icon-shape .ni::before {
    font-family: "NucleoIcons" !important;
    font-weight: normal !important;
    font-style: normal !important;
}

body.dark-mode .icon-shape.bg-danger i,
body.dark-mode .icon-shape.bg-danger svg,
body.dark-mode.dashboard-theme .icon-shape.bg-danger i,
body.dark-mode.dashboard-theme .icon-shape.bg-danger svg {
    color: #ffffff !important;
}

/* =========================
   Cards & generic containers
   ========================= */
.card,
.card.shadow,
.card.bg-secondary {
  background-color: var(--bg-card) !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-soft);
  overflow: hidden !important; /* Ensure children don't overflow rounded corners */
}

.card-header {
  background-color: transparent !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-top-left-radius: var(--radius-lg) !important;
  border-top-right-radius: var(--radius-lg) !important;
}

.card-footer {
  background-color: transparent !important;
  border-top: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-bottom-left-radius: var(--radius-lg) !important;
  border-bottom-right-radius: var(--radius-lg) !important;
}

.card-title {
  color: var(--text-primary) !important;
  font-weight: 600;
}

.card-text {
  color: var(--text-secondary) !important;
}

/* =========================
   Buttons - Modern & Minimal
   ========================= */
.btn {
  border-radius: var(--radius-pill) !important;
  text-transform: none !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.btn-sm {
  font-size: 0.6rem !important;
  padding: 0.15rem 0.3rem !important;
  line-height: 1 !important;
  margin-right: 2px !important;
  margin-bottom: 2px !important;
  min-width: auto !important;
}

.btn-sm i {
  font-size: 0.6rem !important;
  margin-right: 2px !important;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Header action buttons specific style - apply to navbar-top as well */
.navbar-top .btn,
.header .btn,
.header .btn-neutral,
.header .btn-secondary,
.header .btn-primary,
.header .btn-info,
.header .btn-danger,
.header .btn-warning {
  background: rgba(255, 255, 255, 0.05) !important; /* Very subtle background */
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
  box-shadow: none !important;
  margin-left: 0.5rem !important;
}

.navbar-top .btn:hover,
.header .btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-1px);
}

/* Specific button variants in dark mode - subdued */
body.dark-mode .btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

body.dark-mode .btn-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
}

body.dark-mode .btn-success {
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #2ecc71 !important;
}

body.dark-mode .btn-warning {
  background: rgba(249, 115, 22, 0.15) !important;
  border-color: rgba(249, 115, 22, 0.3) !important;
  color: #fb923c !important;
}

body.dark-mode .btn-info {
  background: rgba(6, 182, 212, 0.15) !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
  color: #22d3ee !important;
}

body.dark-mode .btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.2);
}

.btn-info {
  background-color: var(--info) !important;
  border-color: var(--info) !important;
  color: #ffffff !important;
}

.btn-success {
  background-color: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

.btn-danger {
  background-color: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #ffffff !important;
}

.btn-warning {
  background-color: var(--warning) !important;
  border-color: var(--warning) !important;
  color: #111827 !important;
}

.btn-outline-primary {
  background-color: transparent !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.btn-outline-primary:hover {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}

.btn-outline-secondary {
  background-color: transparent !important;
  border-color: var(--border-strong) !important;
  color: var(--text-secondary) !important;
}

.btn-outline-secondary:hover {
  background-color: rgba(148, 163, 184, 0.18) !important;
}

.btn-outline-danger {
  background-color: transparent !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.btn-outline-danger:hover {
  background-color: var(--danger) !important;
  color: #ffffff !important;
}

body.dark-mode .btn-secondary {
  background-color: var(--bg-card-soft) !important;
  border-color: var(--border-subtle) !important;
  color: #fff !important;
}

body.dark-mode .btn-secondary:hover {
  background-color: var(--bg-input) !important;
  border-color: var(--border-subtle) !important;
}

body.dark-mode a:hover {
  color: var(--warning);
}

/* Reinforce nav-pills in dark mode */
body.dark-mode .nav-pills .nav-link:not(.active) {
  background-color: var(--bg-card) !important;
  color: #fff !important;
  border: 1px solid var(--border-subtle) !important;
}

/* Icon-only small button (filter toggle etc.) */
.btn.btn-icon,
.btn-icon-only {
  border-radius: 999px !important;
}

/* =========================
   Forms & inputs
   ========================= */
.form-control,
input.form-control,
textarea.form-control,
select.form-control {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  color: var(--text-primary) !important;
  padding: 0.6rem 1rem !important;
  box-shadow: none !important;
}

.form-control::placeholder {
  color: var(--text-muted) !important;
}

/* Textarea specific - use card radius, not pill */
textarea.form-control {
  border-radius: var(--radius-md) !important;
  resize: vertical;
}

/* Fix white card-body backgrounds */
.card-body,
.card-footer,
.table-responsive,
.table {
  background-color: var(--bg-card) !important;
}

body.dark-mode .card-body,
body.dark-mode .card-footer,
body.dark-mode .table-responsive,
body.dark-mode .table,
body.dark-mode .table tbody,
body.dark-mode .table thead {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .table td,
body.dark-mode .table th {
  background-color: transparent !important;
  border-color: var(--border-subtle) !important;
}

/* Additional fix for white backgrounds in cards */
body.dark-mode .card .card-body,
body.dark-mode .card .table-responsive,
body.dark-mode .bg-white,
body.dark-mode .bg-secondary,
body.dark-mode [class*="bg-white"],
body.dark-mode [class*="bg-secondary"] {
  background-color: var(--bg-card) !important;
}

body:not(.dark-mode) .card .card-body,
body:not(.dark-mode) .card .table-responsive,
body:not(.dark-mode) .bg-white,
body:not(.dark-mode) .bg-secondary {
  background-color: var(--bg-card) !important;
}

/* Force all white backgrounds to use theme colors */
body.dark-mode .main-content *[style*="background: white"],
body.dark-mode .main-content *[style*="background-color: white"],
body.dark-mode .main-content *[style*="background:#fff"],
body.dark-mode .main-content *[style*="background-color:#fff"] {
  background-color: var(--bg-card) !important;
}

body.dark-mode .card {
  background: linear-gradient(145deg, rgba(16, 19, 26, 0.72), rgba(41, 45, 51, 0.55)) !important;
  border: 1px solid var(--border-subtle) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.dark-mode .card .card-header,
body.dark-mode .card .card-body,
body.dark-mode .card .card-footer {
  background-color: transparent !important;
}

body.dark-mode .card .card-header {
  border-bottom-color: var(--border-subtle) !important;
}

/* Hide footer */
.footer,
footer.footer {
  display: none !important;
}

/* Dashboard stat cards equal height */
.card-stats {
  min-height: 130px !important;
}

/* Fix select and date inputs in dark mode */
body.dark-mode select,
body.dark-mode select.form-control,
body.dark-mode .custom-select,
body.dark-mode input[type="date"],
body.dark-mode input[type="text"],
body.dark-mode .datepicker,
body.dark-mode .input-group .form-control,
body.dark-mode .form-control-alternative,
body.dark-mode .input-group-alternative .form-control,
body.dark-mode .input-group-alternative {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: none !important;
}

body.dark-mode .input-group-prepend .input-group-text,
body.dark-mode .input-group-append .input-group-text,
body.dark-mode .input-group-alternative .input-group-text {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode .input-group-alternative,
body.dark-mode .input-group {
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  box-shadow: none !important;
  background-color: var(--bg-card) !important;
}

body.dark-mode .input-group-alternative .form-control,
body.dark-mode .input-group .form-control {
  border: none !important;
  background-color: transparent !important;
}

body.dark-mode .input-group-prepend,
body.dark-mode .input-group-append {
  border: none !important;
}

body.dark-mode .input-daterange,
body.dark-mode .input-daterange.datepicker {
  border: none !important;
  box-shadow: none !important;
}

/* Fix order table filter inputs */
body.dark-mode .input-group.input-group-alternative {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
}

body.dark-mode .input-group.input-group-alternative .form-control {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Fix select2 double frame in dark mode */
body.dark-mode .select2-container--default .select2-selection--single {
  background-color: var(--bg-card) !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode .form-group .select2-container {
  border: none !important;
}

body.dark-mode .form-control-alternative.select2 {
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode select.form-control.form-control-alternative {
  border: none !important;
  box-shadow: none !important;
  background-color: var(--bg-card) !important;
}

body.dark-mode .form-group select.form-control {
  border: none !important;
  box-shadow: none !important;
}

/* Fix Filter button styling */
body.dark-mode .btn,
body.dark-mode .btn-primary,
body.dark-mode .btn-md,
body.dark-mode .btn-block,
body.dark-mode button.btn {
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  box-shadow: none !important;
}

body.dark-mode button.btn.btn-primary.btn-md.btn-block,
body.dark-mode button.btn.btn-primary {
  background-color: var(--bg-card) !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  box-shadow: none !important;
  color: var(--text-primary) !important;
  outline: none !important;
  padding: 10px 20px !important;
}

body.dark-mode .orders-filters .form-group[class*="col-"] {
  background-color: transparent !important;
  background: transparent !important;
}

body.dark-mode .orders-filters .row > [class*="col-"] {
  background-color: transparent !important;
  background: transparent !important;
}

body.dark-mode .orders-filters [class*="col-"] {
  background-color: transparent !important;
  background: transparent !important;
}

body.dark-mode .orders-filters .input-daterange.datepicker,
body.dark-mode .orders-filters .input-daterange {
  background-color: transparent !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode .orders-filters .input-group {
  background-color: transparent !important;
}

body.dark-mode .orders-filters .input-group .form-control {
  background-color: transparent !important;
}

body.dark-mode .orders-filters .input-group-prepend .input-group-text,
body.dark-mode .orders-filters .input-group-append .input-group-text {
  background-color: transparent !important;
}

body.dark-mode .datepicker,
body.dark-mode .datepicker-dropdown,
body.dark-mode .datepicker.datepicker-dropdown {
  z-index: 3000 !important;
}

body.dark-mode .orders-filters button[type="submit"] {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: none !important;
}

/* Fix AI Hub page styling */
body.dark-mode .card {
  background-color: var(--bg-card) !important;
  border-color: var(--border-subtle) !important;
}

body.dark-mode .card-body {
  background-color: var(--bg-card) !important;
}

body.dark-mode .bg-gradient-primary {
  background: #1e293b !important;
}

body.dark-mode .aihub-inner-body {
  background: transparent !important;
  border: none !important;
}

/* AI Hub Container Styling */
.aihub-container-card,
.mobile-apps-container-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
}

/* Light mode: looks like a card */
body:not(.dark-mode) .aihub-container-card,
body:not(.dark-mode) .mobile-apps-container-card {
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, .05);
  border-radius: .375rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; /* shadow-sm */
}

/* Dark mode: transparent */
body.dark-mode .aihub-container-card,
body.dark-mode .mobile-apps-container-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode .aihub-container-card .card-header,
body.dark-mode .mobile-apps-container-card .card-header {
  background: transparent !important;
  border-bottom: none !important;
}

body.dark-mode .mobile-apps-inner-body {
  background: transparent !important;
  border: none !important;
}

#list-container #tabs-icons-text .nav-link,
#list-container #tabs-icons-text .nav-link * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

#list-container #tabs-icons-text .nav-link::selection,
#list-container #tabs-icons-text .nav-link *::selection {
  background: transparent !important;
}

#list-container #tabs-icons-text .nav-link::-moz-selection,
#list-container #tabs-icons-text .nav-link *::-moz-selection {
  background: transparent !important;
}

body.dark-mode .card.shadow-sm,
body.dark-mode .card.shadow,
body.dark-mode .card.hover-elevation,
body.dark-mode .hover-elevation {
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  box-shadow: none !important;
}

body.dark-mode .col-md-4 .card {
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  box-shadow: none !important;
}

/* Global styles for Nestable list (Menu Sorting) */
.dd3-content {
  border-radius: 0.375rem !important;
}

.dd3-handle {
  border-top-left-radius: 0.375rem !important;
  border-bottom-left-radius: 0.375rem !important;
}

/* Redesign drag handle */
.dd3-handle:before {
  content: "\f0c9" !important; /* fa-bars */
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  font-size: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: inherit !important;
  line-height: 1 !important;
}

/* Dark mode styles for Nestable list (Menu Sorting) */
body.dark-mode .dd3-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  color: #fff !important;
}

body.dark-mode .dd3-content:hover {
  color: #2ea8e5 !important;
  background: var(--bg-card) !important;
}

body.dark-mode .dd3-handle {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  color: #fff !important;
}

body.dark-mode .dd3-handle:before {
  color: #fff !important;
}

body.dark-mode .dd3-handle:hover {
  background: var(--bg-card) !important;
  opacity: 0.8;
}

body.dark-mode .item-settings {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  color: #fff !important;
}

body.dark-mode .item-settings p label {
  color: #ccc !important;
}

body.dark-mode .item-settings p label input {
  background-color: transparent !important;
  border: 1px solid var(--border-subtle) !important;
  color: #fff !important;
}

/* Bulk Price Update Form */
body.dark-mode .bulk-price-update {
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* Fix Menu Sorting Container Background in Dark Mode */
body.dark-mode .card > .row.bg-white.menu-manager-row {
  background-color: var(--bg-card) !important;
}

/* Ensure active state for toggle buttons is visible in dark mode */
body.dark-mode .btn-group-toggle .btn.active {
  background-color: #5e72e4 !important;
  color: #fff !important;
  border-color: #5e72e4 !important;
}

/* Make inner row of menu items transparent in dark mode */
body.dark-mode .dd3-content .row,
body.dark-mode .dd3-content span,
body.dark-mode .dd3-content label,
body.dark-mode .dd3-content div {
  background-color: transparent !important;
  background: transparent !important;
}
body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-success,
body.dark-mode .btn-outline-danger,
body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-primary:focus,
body.dark-mode .btn-outline-success:focus,
body.dark-mode .btn-outline-danger:focus,
body.dark-mode .btn-outline-secondary:focus,
body.dark-mode .btn-outline-primary:active,
body.dark-mode .btn-outline-success:active,
body.dark-mode .btn-outline-danger:active,
body.dark-mode .btn-outline-secondary:active {
  background-color: transparent !important;
  background: transparent !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Stretched Link Utility */
.stretched-link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: auto;
  content: "";
  background-color: rgba(0, 0, 0, 0);
}

/* View Modes for Menu Items */
@media (min-width: 992px) {
  /* List Mode: Full width */
  .category-items.view-list .col-lg-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Icon Mode: 3 per row */
  .category-items.view-icon .col-lg-6 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
}

/* List Mode Styling */
.category-items.view-list .menu-item-card .item-image-wrapper {
  flex: 0 0 10%;
  max-width: 10%;
  padding-right: 0;
}

.category-items.view-list .menu-item-card .col-md-8 {
  flex: 0 0 90%;
  max-width: 90%;
}

.category-items.view-list .item-image {
  height: 60px;
  width: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.category-items.view-list .menu-item-card .card-body {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.category-items.view-list .menu-item-card .item-title {
  margin-bottom: 0;
  font-size: 1rem;
  flex-grow: 1;
}

.category-items.view-list .menu-item-card .item-description {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0;
  width: 100%;
}

.category-items.view-list .menu-item-card .item-price {
  font-weight: bold;
}

/* Icon Mode Styling (Image Top) */
.category-items.view-icon .menu-item-card .row {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.category-items.view-icon .menu-item-card .item-image-wrapper {
  order: -1;
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 200px !important;
  height: 200px !important;
  padding: 0 !important;
  overflow: hidden;
  display: block !important;
}

.category-items.view-icon .menu-item-card .col-md-8 {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 auto !important;
  padding: 0;
}

.category-items.view-icon .menu-item-card .item-image {
  height: 100% !important;
  width: 100% !important;
  object-fit: cover !important;
  border-radius: 0.375rem 0.375rem 0 0;
  display: block !important;
}

.category-items.view-icon .menu-item-card .card-body {
  padding: 1.25rem;
}

/* Fix impersonate back button and user info in sidebar */
body.dark-mode .nav-link.active-pro {
  background-color: transparent !important;
  background: transparent !important;
  border: 1px solid var(--border-subtle) !important;
  border-left: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  padding: 8px 16px !important;
  font-size: 0.875rem !important;
  margin: 0 10px 15px 10px !important;
}

body.dark-mode .nav-link.active-pro::before {
  display: none !important;
}

body.dark-mode .nav-item .nav-link.active-pro.active {
  background: transparent !important;
  border-left: 1px solid var(--border-subtle) !important;
}

body.dark-mode .sidenav-header .media,
body.dark-mode .sidenav-header .dropdown-menu,
body.dark-mode .navbar-vertical .navbar-collapse .media,
body.dark-mode .media.align-items-center {
  background-color: transparent !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  padding: 8px 16px !important;
}

body.dark-mode .media.align-items-center .media-body {
  color: var(--text-primary) !important;
}

body.dark-mode .media.align-items-center .media-body span {
  color: var(--text-primary) !important;
}

body.dark-mode .user-account-section .d-flex {
  background-color: transparent !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
}

body.dark-mode .user-account-section h5,
body.dark-mode .user-account-section small {
  color: var(--text-primary) !important;
}

body.dark-mode .user-account-section svg {
  stroke: var(--text-primary) !important;
  width: 16px !important;
  height: 16px !important;
}

body.dark-mode .user-account-section .dropdown {
  margin-right: 10px !important;
  position: relative !important;
  right: 5px !important;
}

/* Light mode - Go Back button and user account section */
body:not(.dark-mode) .nav-link.active-pro {
  background-color: transparent !important;
  background: transparent !important;
  border: 1px solid #dee2e6 !important;
  border-radius: var(--radius-pill) !important;
  padding: 8px 16px !important;
  font-size: 0.875rem !important;
  margin: 0 10px 15px 10px !important;
}

body:not(.dark-mode) .nav-link.active-pro::before {
  display: none !important;
}

body:not(.dark-mode) .user-account-section .d-flex {
  background-color: transparent !important;
  border: 1px solid #dee2e6 !important;
  border-radius: var(--radius-md) !important;
}

body:not(.dark-mode) .user-account-section .dropdown {
  margin-right: 10px !important;
  position: relative !important;
  right: 5px !important;
}

/* Plan cards equal height with scrollable features */
.card-body-wrap .card.shadow {
  height: 650px !important;
  display: flex !important;
  flex-direction: column !important;
}

.card-body-wrap .card.shadow .card-header {
  padding: 15px !important;
}

.card-body-wrap .card.shadow .card-img-top {
  border-radius: 8px !important;
  margin: 0 !important;
}

.card-body-wrap .card.shadow .card-header .col-8 {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}

.card-body-wrap .card.shadow .card-header .col-4 {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}

.card-body-wrap .card.shadow .card-header .col-4 h3 {
  color: #d4e157 !important;
}

/* Fix white block on overview page in dark mode */
body.dark-mode .card.bg-white,
body.dark-mode .bg-white {
  background-color: var(--bg-card) !important;
}

body.dark-mode .thead-light th {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* Fix navbar visibility on all pages */
.navbar-top {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: 250px !important;
  z-index: 1030 !important;
  background-color: var(--bg-sidebar) !important;
}

.navbar-top .container-fluid {
  padding-right: 360px !important;
}

.navbar-top .navbar-nav.align-items-center {
  margin-right: 350px !important;
}

.navbar-top .navbar-nav {
  flex-wrap: nowrap !important;
}

@media (max-width: 768px) {
  .navbar-top {
    left: 0 !important;
  }
}

body.dark-mode .navbar-top {
  background-color: var(--bg-body) !important;
}

body.dark-mode .main-content {
  background-color: var(--bg-body) !important;
}

.navbar-top,
.navbar-top .container-fluid,
#navbar-main {
  overflow: visible !important;
}

.navbar-top .dropdown-menu {
  z-index: 2000 !important;
}

body.dark-mode .breadcrumb,
body.dark-mode .breadcrumb.breadcrumb-dark {
  background: linear-gradient(145deg, rgba(16, 19, 26, 0.72), rgba(41, 45, 51, 0.55)) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  box-shadow: none !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.dark-mode .breadcrumb .breadcrumb-item a {
  color: var(--text-secondary) !important;
}

body.dark-mode .breadcrumb .breadcrumb-item a:hover {
  color: var(--text-primary) !important;
}

body.dark-mode .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  color: var(--text-muted) !important;
}

body.dark-mode .breadcrumb .breadcrumb-item.active {
  color: var(--text-primary) !important;
}

body.dark-mode {
  background-color: var(--bg-body) !important;
}

body.dark-mode html,
body.dark-mode body,
html.dark-mode,
.dark-mode {
  background-color: var(--bg-body) !important;
}

body.dark-mode .col-md-4 {
  background-color: transparent !important;
}

html, body {
  overflow-x: hidden !important;
}

/* Remove button style from Dashboard menu item */
.navbar-vertical .navbar-nav .nav-link.active:not(.active-pro),
.sidenav .navbar-nav .nav-link.active:not(.active-pro),
.navbar-nav .nav-item .nav-link.active:not(.active-pro) {
  background-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: inherit !important;
}

body.dark-mode .navbar-nav .nav-item .nav-link.active:not(.active-pro) {
  background-color: transparent !important;
  background: transparent !important;
}

.card-body-wrap .card.shadow .table-responsive {
  max-height: 350px !important;
  overflow-y: scroll !important;
  flex: 1 !important;
  scrollbar-width: thin !important;
  scrollbar-color: #6b7280 transparent !important;
}

.card-body-wrap .card.shadow .table-responsive::-webkit-scrollbar {
  width: 8px !important;
  display: block !important;
}

.card-body-wrap .card.shadow .table-responsive::-webkit-scrollbar-track {
  background: transparent !important;
}

.card-body-wrap .card.shadow .table-responsive::-webkit-scrollbar-thumb {
  background-color: #6b7280 !important;
  border-radius: 4px !important;
}

.card-body-wrap .card.shadow .card-footer {
  margin-top: auto !important;
}

.card-body-wrap .row > [class*="col-"] {
  margin-bottom: 30px !important;
}

body.dark-mode .dropdown-menu {
  background-color: var(--bg-card) !important;
  border-color: var(--border-subtle) !important;
}

body.dark-mode .dropdown-menu .dropdown-item {
  color: var(--text-primary) !important;
}

/* Fix double frame on select dropdowns */
body.dark-mode .form-group {
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode select.form-control-alternative,
body.dark-mode .form-control-alternative,
body.dark-mode .form-control-alternative:focus {
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  background-image: none !important;
  outline: none !important;
}

body.dark-mode .form-group select,
body.dark-mode .form-group select:focus {
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  outline: none !important;
}

body.dark-mode .form-group .form-control,
body.dark-mode .form-group .form-control:focus {
  box-shadow: none !important;
}

body.dark-mode .select2-container,
body.dark-mode .select2-container--default .select2-selection--single {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
}

body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-primary) !important;
}

body.dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-muted) transparent transparent transparent !important;
}

body.dark-mode select option {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .form-control::placeholder {
  color: var(--text-muted) !important;
}

/* Image upload sections - framed like allergens cards */
#tabs-icons-text-2 .col-md-4 {
  margin-bottom: 1.5rem;
}

#tabs-icons-text-2 .col-md-4 .form-group,
#tabs-icons-text-2 .col-md-4 > div {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.input-group.input-group-alternative .input-group-text {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-right: none !important;
  border-radius: var(--radius-pill) 0 0 var(--radius-pill) !important;
  color: var(--text-muted) !important;
}

.input-group.input-group-alternative .form-control {
  border-left: none !important;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0 !important;
}

/* Native selects */
select,
select.form-control,
select.custom-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  padding-right: 2.5rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  box-shadow: none !important;
}

select option {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* Dark-mode selects: cleaner look with lighter palette */
body.dark-mode select,
body.dark-mode select.form-control,
body.dark-mode select.custom-select {
  background-color: #1e293b !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
  box-shadow: none !important;
}

body.dark-mode select option {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

/* Select2 */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-pill) !important;
  min-height: 44px !important;
}

/* Prevent "double container" look when Select2 wrapper is also styled as a form-control */
.select2-container.form-control,
.select2-container--default.form-control,
.select2-container--default.select2-container--open.form-control,
.select2-container--default.select2-container--focus.form-control {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  height: auto !important;
}

.select2-container.form-control .select2-selection--single,
.select2-container.form-control .select2-selection--multiple {
  width: 100% !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-primary) !important;
  line-height: 42px !important;
  padding: 0 2.5rem 0 1.1rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px !important;
  right: 12px !important;
}

.select2-dropdown {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-soft) !important;
}

.select2-results__option {
  color: var(--text-secondary) !important;
}

.select2-results__option--highlighted[aria-selected],
.select2-results__option:hover {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}

/* Dark-mode Select2 dropdown */
body.dark-mode .select2-container--default .select2-selection--single,
body.dark-mode .select2-container--default .select2-selection--multiple {
  background-color: #1e293b !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}

body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #f1f5f9 !important;
}

body.dark-mode .select2-dropdown,
body.dark-mode .select2-results__options {
  background-color: #1e293b !important;
  border-color: #475569 !important;
}

body.dark-mode .select2-results__option {
  color: #e2e8f0 !important;
}

/* Bootstrap dropdown menus in dark mode */
body.dark-mode .dropdown-menu {
  background-color: #1e293b !important;
  border-color: #475569 !important;
  border-radius: var(--radius-md) !important;
}

body.dark-mode .dropdown-item {
  color: #f1f5f9 !important;
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
  background-color: #334155 !important;
  color: #ffffff !important;
}

/* =========================
   Tables
   ========================= */
.table {
  margin-bottom: 0;
  color: var(--text-secondary);
}

.table thead th,
.thead-light th {
  background-color: var(--bg-card-soft) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-muted) !important;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table tbody td {
  border-top: 1px solid var(--border-subtle) !important;
  vertical-align: middle;
}

.table-hover tbody tr:hover td {
  background-color: rgba(148, 163, 184, 0.08) !important;
}

.table .badge-success {
  background-color: rgba(34, 197, 94, 0.16) !important;
  color: #22c55e !important;
}

.table .badge-warning {
  background-color: rgba(249, 115, 22, 0.16) !important;
  color: #fb923c !important;
}

.table a {
  color: var(--primary) !important;
}

/* =========================
   Tabs (nav-pills)
   ========================= */
.nav-pills .nav-link {
  border-radius: var(--radius-pill) !important;
  padding: 0.5rem 1.4rem !important;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-secondary) !important;
  font-weight: 600;
  margin-right: 0.4rem;
}

.nav-pills .nav-link:hover {
  background-color: rgba(148, 163, 184, 0.1) !important;
}

.nav-pills .nav-link.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

/* Dark-mode specific tabs */
body.dark-mode .nav-pills .nav-link {
  background-color: #1e293b !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.dark-mode .nav-pills .nav-link:hover {
  background-color: #334155 !important;
  border-color: #6366f1 !important;
}

body.dark-mode .nav-pills .nav-link.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
}

/* =========================
   Topbar actions slot (action buttons in navbar)
   ========================= */
.topbar-actions-slot {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: nowrap !important;
}

.topbar-actions-slot:empty {
  display: none !important;
}

.topbar-actions-slot .btn {
  margin: 0 0.15rem !important;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Ensure navbar-nav items stay inline - FORCE single row */
#navbar-main .navbar-nav.align-items-center {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
}

#navbar-main .navbar-nav.align-items-center > li,
#navbar-main .navbar-nav.align-items-center > .nav-item {
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0;
}

/* Force container to use all available width */
#navbar-main .container-fluid {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* =========================
   Theme toggle (navbar top)
   ========================= */
.theme-toggle {
  position: relative !important;
  top: auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  cursor: pointer;
  overflow: hidden;
  vertical-align: middle;
}

.theme-toggle-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  transition: transform 0.2s ease;
}

.theme-toggle-icon-sun,
.theme-toggle-icon-moon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: #facc15;
}

.theme-toggle-icon-sun {
  left: 7px;
}

.theme-toggle-icon-moon {
  right: 8px;
  color: #e5e7eb;
}

.theme-toggle.is-dark .theme-toggle-thumb {
  transform: translateX(22px);
}

/* Icon emphasis per state */
.theme-toggle .theme-toggle-icon-sun,
.theme-toggle .theme-toggle-icon-moon {
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

.theme-toggle.is-dark .theme-toggle-icon-moon {
  opacity: 1;
}

.theme-toggle.is-dark .theme-toggle-icon-sun {
  opacity: 0.25;
}

.theme-toggle:not(.is-dark) .theme-toggle-icon-sun {
  opacity: 1;
}

.theme-toggle:not(.is-dark) .theme-toggle-icon-moon {
  opacity: 0.3;
}

/* =========================
   Plugins sub-tabs (Settings > Apps & Plugins)
   ========================= */
.plugins-subtabs {
  padding: 1rem 0;
}

.plugins-category-tabs {
  margin-bottom: 1.5rem !important;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.plugins-category-tabs .nav-link {
  padding: 0.5rem 1rem !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius-sm) !important;
  margin-right: 0.5rem !important;
}

body.dark-mode .plugins-category-tabs .nav-link {
  background-color: transparent !important;
  border: 1px solid #334155 !important;
  color: #94a3b8 !important;
}

body.dark-mode .plugins-category-tabs .nav-link:hover {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
}

body.dark-mode .plugins-category-tabs .nav-link.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

/* Collapsible section styling */
.plugins-section {
  background-color: var(--bg-card-soft);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

body.dark-mode .plugins-section {
  background-color: rgba(30, 41, 59, 0.5);
  border: 1px solid #334155;
}

.plugins-section-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.plugins-section-header:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .plugins-section-header:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.plugins-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  width: 100%;
}

body.dark-mode .plugins-section-title {
  color: #e2e8f0 !important;
}

.plugins-section-chevron {
  transition: transform 0.3s ease;
  font-size: 0.75rem;
  color: #64748b;
}

body.dark-mode .plugins-section-chevron {
  color: #94a3b8;
}

/* Rotate chevron when expanded */
.plugins-section-header:not(.collapsed) .plugins-section-chevron {
  transform: rotate(180deg);
}

.plugins-section-body {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

body.dark-mode .plugins-section-body {
  border-color: #334155;
}

.plugins-section-body .form-group {
  margin-bottom: 1rem;
}

/* =========================
   Apps page
   ========================= */
.apps-page .card-header {
  border-bottom: none !important;
}

.apps-page .card-body {
  padding-top: 0.5rem !important;
}

.apps-page .nav-pills {
  margin-bottom: 1.25rem;
}

.apps-page .input-group.input-group-alternative .form-control {
  min-width: 260px;
}

.apps-page .row.apps-grid > [class^="col-"],
.apps-page .row.apps-grid > [class*=" col-"] {
  display: flex;
}

.apps-page .row.apps-grid .card {
  width: 100% !important;
  display: flex;
  flex-direction: column;
}

.apps-page .row.apps-grid .card-img-top {
  height: 180px;
  object-fit: cover;
}

.apps-page .row.apps-grid .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.apps-page .row.apps-grid .card-body .card-text {
  flex: 1;
}

.apps-page .row.apps-grid .card-body .btn {
  margin-top: 0.25rem;
}

/* =========================
   Misc dark-mode helpers
   ========================= */
body.dark-mode .bg-white,
body.dark-mode .bg-light,
body.dark-mode .bg-secondary {
  background-color: #1e293b !important;
}

body.dark-mode .badge.badge-success {
  background-color: rgba(34, 197, 94, 0.25) !important;
  color: #4ade80 !important;
}

body.dark-mode .badge.badge-warning {
  background-color: rgba(249, 115, 22, 0.25) !important;
  color: #fb923c !important;
}

/* Dark mode text colors */
body.dark-mode .text-dark,
body.dark-mode .text-black {
  color: #f1f5f9 !important;
}

body.dark-mode .text-muted {
  color: #94a3b8 !important;
}

/* Dark mode form labels */
body.dark-mode label,
body.dark-mode .form-control-label {
  color: #e2e8f0 !important;
}

/* Dark mode accordion/collapse headers */
body.dark-mode .accordion .card-header,
body.dark-mode .collapse-header {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* =========================
   Header & page background – avoid double colors in dark mode
   ========================= */
body.dark-mode .header,
body.dark-mode .header.bg-gradient-primary,
body.dark-mode .header.bg-primary {
  background-color: var(--bg-header) !important;
  background-image: none !important;
}

/* LIGHT MODE: Flatten gradient headers completely */
body:not(.dark-mode) .header.bg-gradient-primary,
body:not(.dark-mode) .header.bg-primary,
body:not(.dark-mode) .bg-gradient-primary,
body:not(.dark-mode) .bg-primary,
body:not(.dark-mode) [class*="bg-gradient"],
body:not(.dark-mode) .header {
  background: #e2e8f0 !important;
  background-color: #e2e8f0 !important;
  background-image: none !important;
}

/* Light mode header text colors */
body:not(.dark-mode) .header h1,
body:not(.dark-mode) .header h2,
body:not(.dark-mode) .header h3,
body:not(.dark-mode) .header h4,
body:not(.dark-mode) .header h5,
body:not(.dark-mode) .header h6,
body:not(.dark-mode) .header .text-white {
  color: #1e293b !important;
}

/* LIGHT MODE: Override navbar-dark to light */
body:not(.dark-mode) .navbar-dark,
body:not(.dark-mode) .navbar-top,
body:not(.dark-mode) #navbar-main {
  background-color: #e2e8f0 !important;
  background: #e2e8f0 !important;
}

/* LIGHT MODE: Match header spacing with dark mode */
body:not(.dark-mode) .header {
  padding-top: 1.5rem !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  min-height: 80px !important;
}

body:not(.dark-mode) .container-fluid.mt--7 {
  margin-top: 0 !important;
  padding-top: 80px !important;
}

/* LIGHT MODE: Toggle switcher colors */
body:not(.dark-mode) .theme-toggle-track {
  background-color: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

body:not(.dark-mode) .theme-toggle-thumb {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

body:not(.dark-mode) .theme-toggle-icon-sun {
  color: #f59e0b !important;
}

body:not(.dark-mode) .theme-toggle-icon-moon {
  color: #64748b !important;
}

body:not(.dark-mode) .navbar-dark .navbar-brand,
body:not(.dark-mode) .navbar-dark .text-white,
body:not(.dark-mode) .navbar-top .text-white,
body:not(.dark-mode) #navbar-main .text-white,
body:not(.dark-mode) .navbar-top .h4,
body:not(.dark-mode) #navbar-main .h4 {
  color: #1e293b !important;
}

/* Make body and main-content a single solid color in dark mode */
body.dark-mode,
body.dark-mode .main-content {
  background-color: var(--bg-body) !important;
}

/* Fix white band at top of page */
body.dark-mode .header.bg-gradient-primary,
body.dark-mode .header.bg-primary,
body.dark-mode .bg-gradient-primary,
body.dark-mode .bg-primary {
  background: var(--bg-header) !important;
  background-image: none !important;
}

/* Fix the page title area background in dark mode */
body.dark-mode .header .pb-8,
body.dark-mode .header .pb-7,
body.dark-mode .header .pb-6,
body.dark-mode .header .pt-5,
body.dark-mode .header .pt-md-8 {
  background-color: transparent !important;
}

/* Remove any white strips/borders at top */
body.dark-mode .border-top,
body.dark-mode hr {
  border-color: var(--border-subtle) !important;
}

/* Fix any light backgrounds in header area */
body.dark-mode .header *,
body.dark-mode #navbar-main * {
  background-image: none !important;
}

/* Ensure consistent header/title area in dark mode */
body.dark-mode .main-content > .header,
body.dark-mode .main-content .header {
  background-color: var(--bg-header) !important;
}

/* Header - light mode styling */
.header,
#navbar-main,
.navbar-top {
  background-color: #ffffff !important;
  background-image: none !important;
}

.navbar-top .navbar-brand,
.navbar-top .h4,
.navbar-top a.h4 {
  color: #1e293b !important;
}

/* Light mode navbar buttons */
.navbar-top .btn {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

.navbar-top .btn:hover {
  background-color: #e2e8f0 !important;
  color: #1e293b !important;
}

/* Light mode user dropdown */
.navbar-top .nav-link {
  color: #475569 !important;
}

.navbar-top .nav-link:hover {
  color: #1e293b !important;
}

/* Dark mode header override */
body.dark-mode .header,
body.dark-mode #navbar-main,
body.dark-mode .navbar-top {
  background-color: var(--bg-body) !important;
  background-image: none !important;
}

body.dark-mode .navbar-top .navbar-brand,
body.dark-mode .navbar-top .h4,
body.dark-mode .navbar-top a.h4 {
  color: #e2e8f0 !important;
}

body.dark-mode .navbar-top .btn {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

body.dark-mode .navbar-top .btn:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body.dark-mode .navbar-top .nav-link {
  color: #94a3b8 !important;
}

body.dark-mode .navbar-top .nav-link:hover {
  color: #e2e8f0 !important;
}

/* Fix the title bar area specifically */
body.dark-mode .header h2,
body.dark-mode .header h1,
body.dark-mode .header h3,
body.dark-mode .header .h2,
body.dark-mode .header .h1 {
  color: var(--text-primary) !important;
}

/* Remove gradient backgrounds from header children */
body.dark-mode .header [class*="bg-gradient"],
body.dark-mode .header [class*="bg-primary"],
body.dark-mode .header [class*="bg-secondary"] {
  background: transparent !important;
  background-image: none !important;
}

/* Ensure html and body have no white background */
html,
html.dark-mode,
body.dark-mode {
  background-color: var(--bg-body) !important;
}

/* Fix the white line at very top of page */
body.dark-mode {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

body.dark-mode .main-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: none !important;
}

/* Fix any potential white space at top */
body.dark-mode::before {
  display: none !important;
}

/* CRITICAL: Make ENTIRE right side ONE FLAT dark color */
body.dark-mode .main-content {
  background-color: var(--bg-body) !important;
}

/* Remove the pseudo-element - not needed */
body.dark-mode .main-content::before {
  display: none !important;
}

/* Make ALL header elements SAME as body - #0f172a */
body.dark-mode .header,
body.dark-mode .header.bg-gradient-primary,
body.dark-mode .header.bg-gradient-info,
body.dark-mode .header.bg-primary,
body.dark-mode .header[class*="bg-gradient"],
body.dark-mode .header[class*="bg-primary"] {
  background: var(--bg-body) !important;
  background-color: var(--bg-body) !important;
  background-image: none !important;
}

/* Make navbar-top SAME as body - #0f172a */
body.dark-mode #navbar-main,
body.dark-mode .navbar-top,
body.dark-mode .navbar-top.navbar-dark {
  background: var(--bg-body) !important;
  background-color: var(--bg-body) !important;
}

html.dark-mode #navbar-main,
html.dark-mode .navbar-top,
html.dark-mode .navbar-top.navbar-dark,
.dark-mode #navbar-main,
.dark-mode .navbar-top,
.dark-mode .navbar-top.navbar-dark {
  background: var(--bg-body) !important;
  background-color: var(--bg-body) !important;
  background-image: none !important;
}

html.dark-mode #navbar-main::before,
html.dark-mode #navbar-main::after,
.dark-mode #navbar-main::before,
.dark-mode #navbar-main::after {
  display: none !important;
  background: none !important;
  background-image: none !important;
}

html.dark-mode #navbar-main > .container-fluid,
.dark-mode #navbar-main > .container-fluid {
  background: transparent !important;
  background-image: none !important;
}

/* Remove ALL borders that might cause lines */
body.dark-mode .header,
body.dark-mode #navbar-main,
body.dark-mode .navbar-top,
body.dark-mode .main-content {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

/* Fix any padding/margin classes */
body.dark-mode .header.pb-8,
body.dark-mode .header.pb-7,
body.dark-mode .header.pb-6,
body.dark-mode .header.pt-5,
body.dark-mode .header.pt-md-8 {
  background: var(--bg-body) !important;
}

/* Remove the white/light line at very top */
body.dark-mode .main-content,
body.dark-mode .main-content > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Fix spacing between header and content in dark mode */
body.dark-mode .container-fluid.mt--7 {
  margin-top: 0 !important; /* Reset negative margin */
  padding-top: 80px !important; /* Add positive spacing */
}

body.dark-mode .header {
  padding-bottom: 0 !important; /* Remove excessive padding from header bottom */
  margin-bottom: 0 !important;
}

/* =========================
   Dark-mode cards – lighter surfaces with subtle highlight
   ========================= */
body.dark-mode .card,
body.dark-mode .card.shadow,
body.dark-mode .card.bg-secondary {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode .card:hover {
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

/* Fix stuck modal backdrop issue */
.modal-backdrop {
  display: none !important;
}
.modal-backdrop.show {
  display: block !important;
}
body.modal-open {
  overflow: auto !important;
  padding-right: 0 !important;
}

