/* ============================================================
   Modern Theme + Dark/Light Mode overlay for AdminLTE 2
   Loaded AFTER AdminLTE.css / skins / style.css so it wins.
   Theme is switched via  <html data-theme="light|dark">.
   ============================================================ */

:root {
  /* Brand */
  --primary:        #3c8dbc;
  --primary-600:    #367fa9;
  --primary-700:    #2b6a8f;
  --primary-soft:   rgba(60, 141, 188, 0.12);

  /* Light palette (default) */
  --bg:             #eef1f6;
  --surface:        #ffffff;
  --surface-2:      #f6f8fb;
  --surface-3:      #eef2f7;
  --header-bg:      #ffffff;
  --header-text:    #2b3648;
  --sidebar-bg:     #1f2a37;
  --sidebar-text:   #b9c6d4;
  --sidebar-active: #3c8dbc;
  --text:           #2b3648;
  --text-muted:     #6b7a90;
  --border:         #e4e9f0;
  --border-strong:  #d5dce6;
  --shadow:         0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg:      0 8px 24px rgba(16,24,40,.10);
  --radius:         12px;
  --radius-sm:      8px;
  --input-bg:       #ffffff;
  --danger:         #e5573f;
  --success:        #24a367;
  --warning:        #e0a12e;
}

html[data-theme="dark"] {
  --bg:             #0f1720;
  --surface:        #1a2531;
  --surface-2:      #212e3c;
  --surface-3:      #26343f;
  --header-bg:      #16202b;
  --header-text:    #e7edf4;
  --sidebar-bg:     #131c25;
  --sidebar-text:   #9fb0c0;
  --sidebar-active: #4aa3d5;
  --primary:        #4aa3d5;
  --primary-600:    #3c8dbc;
  --primary-soft:   rgba(74, 163, 213, 0.16);
  --text:           #e4ecf4;
  --text-muted:     #93a4b7;
  --border:         #2a3947;
  --border-strong:  #34465a;
  --shadow:         0 1px 3px rgba(0,0,0,.45);
  --shadow-lg:      0 12px 30px rgba(0,0,0,.55);
  --input-bg:       #212e3c;
}

/* ---------- Base ---------- */
body,
.content-wrapper,
.right-side {
  background-color: var(--bg) !important;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
a { color: var(--primary); }
a:hover, a:focus { color: var(--primary-700); }
hr { border-top-color: var(--border); }
.text-muted, small, .small { color: var(--text-muted) !important; }

/* ---------- Header / Navbar ---------- */
.main-header .navbar,
.main-header .logo {
  background: var(--header-bg) !important;
  color: var(--header-text) !important;
  box-shadow: var(--shadow);
  transition: background-color .25s ease;
}
.main-header .logo,
.main-header .navbar .nav > li > a,
.main-header h3,
.main-header .navbar .sidebar-toggle {
  color: var(--header-text) !important;
}
.main-header .logo { border-bottom: 1px solid var(--border); font-weight: 700; }
.main-header .navbar { border-bottom: 1px solid var(--border); }
.main-header .navbar .nav > li > a:hover,
.main-header .navbar .nav > li > a:focus,
.main-header .sidebar-toggle:hover {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}
.main-header .navbar h3 { font-weight: 600; }

/* Theme toggle button */
.theme-toggle { cursor: pointer; }
.theme-toggle .fa { font-size: 17px; line-height: 20px; }

/* ---------- Sidebar ---------- */
.main-sidebar,
.left-side {
  background: var(--sidebar-bg) !important;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.28) 100%), var(--sidebar-bg) !important;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.03);
}
.sidebar { padding-bottom: 20px; }
.sidebar-menu { padding: 6px 0; }

/* Top-level items */
.sidebar-menu > li { margin: 2px 10px; }
.sidebar-menu > li > a {
  color: var(--sidebar-text);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
.sidebar-menu > li > a > i:first-child {
  width: 24px;
  min-width: 24px;
  text-align: center;
  font-size: 16px;
  margin-right: 8px;
  transition: color .2s ease, transform .2s ease;
}
.sidebar-menu > li > a > span { flex: 1; }

/* Hover */
.sidebar-menu > li:hover > a {
  background: rgba(255,255,255,.06) !important;
  color: #fff !important;
  transform: translateX(2px);
}
.sidebar-menu > li:hover > a > i:first-child { color: var(--sidebar-active); }

/* Active leaf — floating gradient pill */
.sidebar-menu > li.active:not(.treeview) > a,
.sidebar-menu > li.treeview.active > a {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px -4px rgba(60,141,188,.45);
}
.sidebar-menu > li.active > a > i:first-child { color: #fff !important; }

/* Parent that is merely open (not the active leaf) — subtle highlight */
.sidebar-menu > li.treeview.menu-open:not(.active) > a {
  background: rgba(255,255,255,.05) !important;
  color: #fff !important;
}

/* Expand / collapse arrow */
.sidebar-menu > li > a > .fa-angle-left {
  flex: 0 0 auto;
  margin-right: 0;
  transition: transform .25s ease;
}
.sidebar-menu > li.menu-open > a > .fa-angle-left { transform: rotate(-90deg); }

/* Section headers */
.sidebar-menu > li.header {
  background: transparent !important;
  color: #6d7f8f !important;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
  font-weight: 700;
  padding: 16px 22px 6px;
  margin: 0;
}

/* Submenus */
.sidebar-menu .treeview-menu {
  background: rgba(0,0,0,.16) !important;
  border-radius: 10px;
  margin: 4px 4px 6px;
  padding: 4px 0 4px 6px;
  position: relative;
}
.sidebar-menu .treeview-menu::before {
  content: "";
  position: absolute;
  left: 15px; top: 8px; bottom: 8px;
  width: 2px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
}
.sidebar-menu .treeview-menu > li > a {
  color: var(--sidebar-text);
  font-size: 13px;
  padding: 8px 12px 8px 26px;
  border-radius: 8px;
  position: relative;
  transition: all .18s ease;
}
.sidebar-menu .treeview-menu > li > a > i:first-child {
  width: 18px; min-width: 18px; font-size: 13px; margin-right: 6px;
}
.sidebar-menu .treeview-menu > li > a::before {
  content: "";
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  transition: all .18s ease;
}
.sidebar-menu .treeview-menu > li > a:hover {
  background: rgba(255,255,255,.05) !important;
  color: #fff !important;
  padding-left: 30px;
}
.sidebar-menu .treeview-menu > li > a:hover::before { background: var(--sidebar-active); }
.sidebar-menu .treeview-menu > li.active > a {
  color: #fff !important;
  font-weight: 600;
}
.sidebar-menu .treeview-menu > li.active > a::before {
  background: var(--sidebar-active);
  box-shadow: 0 0 0 3px rgba(74,163,213,.3);
}

/* Custom sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* Collapsed (sidebar-mini) hover flyout keeps the pill look tidy */
.sidebar-mini.sidebar-collapse .sidebar-menu > li { margin: 2px 6px; }
.sidebar-mini.sidebar-collapse .sidebar-menu > li > a { border-radius: 10px; }

.user-panel > .info, .user-panel > .info > a { color: #fff; }

/* ---------- Boxes / Cards / Panels ---------- */
.box,
.panel,
.info-box,
.small-box,
.nav-tabs-custom,
.widget-block {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text);
}
.box { border-top: 3px solid var(--primary) !important; }
.box-header { color: var(--text); border-bottom: 1px solid var(--border); }
.box-header .box-title { font-weight: 600; }
.box-footer { background: transparent !important; border-top: 1px solid var(--border); }
.panel-heading { border-color: var(--border); }
.panel-body { color: var(--text); }
.box.box-primary { border-top-color: var(--primary) !important; }

/* ---------- Content header ---------- */
.content-header > h1 { color: var(--text); font-weight: 600; }
.content-header > h1 > small { color: var(--text-muted); }
.breadcrumb { background: transparent; }

/* ---------- Tables ---------- */
.table { color: var(--text); }
.table > thead > tr > th {
  border-bottom: 2px solid var(--border-strong);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .03em;
}
.table > tbody > tr > td,
.table > tbody > tr > th,
.table-bordered > tbody > tr > td,
.table-bordered > thead > tr > th,
.table-bordered,
.table > thead > tr > th {
  border-color: var(--border) !important;
}
.table-striped > tbody > tr:nth-of-type(odd) { background: var(--surface-2); }
.table-hover > tbody > tr:hover { background: var(--primary-soft); }

/* ---------- Forms ---------- */
.form-control,
.select2-selection,
.input-group-addon {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-soft) !important;
}
.form-control::placeholder { color: var(--text-muted); opacity: .8; }
.input-group-addon { background: var(--surface-3) !important; color: var(--text-muted) !important; }
label { color: var(--text); font-weight: 600; }
.control-label { color: var(--text); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; transition: all .15s ease; }
.btn-primary { background: var(--primary); border-color: var(--primary-600); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-600); border-color: var(--primary-700); }
.btn-default {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
}
.btn-default:hover { background: var(--surface-3) !important; }
.btn-flat { border-radius: var(--radius-sm); }

/* ---------- Dropdowns / modals ---------- */
.dropdown-menu {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
}
.dropdown-menu > li > a { color: var(--text) !important; }
.dropdown-menu > li > a:hover { background: var(--primary-soft) !important; color: var(--primary) !important; }
.dropdown-menu .divider { background: var(--border); }
.modal-content {
  background: var(--surface) !important;
  color: var(--text);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}
.modal-header, .modal-footer { border-color: var(--border); }
.modal-backdrop.in { opacity: .55; }

/* ---------- Alerts ---------- */
.alert { border: none; border-radius: var(--radius-sm); border-left: 4px solid; }
.alert-success { background: rgba(36,163,103,.12); color: var(--success); border-left-color: var(--success); }
.alert-danger  { background: rgba(229,87,63,.12);  color: var(--danger);  border-left-color: var(--danger); }
.alert-warning { background: rgba(224,161,46,.12); color: var(--warning); border-left-color: var(--warning); }
.alert-info    { background: var(--primary-soft);  color: var(--primary); border-left-color: var(--primary); }

/* ---------- DataTables ---------- */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 8px;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_paginate { color: var(--text-muted) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--surface) !important;
  margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary-600) !important;
}

/* ---------- select2 ---------- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background: var(--input-bg) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text) !important; }
.select2-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text);
}
.select2-container--default .select2-results__option { color: var(--text); }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--primary) !important; color: #fff !important;
}
.select2-search__field { background: var(--input-bg) !important; color: var(--text) !important; }

/* ---------- Footer ---------- */
.main-footer {
  background: var(--surface) !important;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}
.main-footer a { color: var(--primary); }

/* ---------- Misc small-box / info-box numbers keep contrast ---------- */
html[data-theme="dark"] .small-box .icon { color: rgba(255,255,255,.15); }
html[data-theme="dark"] .box.box-solid > .box-header { color: #fff; }
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .well { background: var(--surface-2) !important; color: var(--text); }
html[data-theme="dark"] pre {
  background: var(--surface-2) !important; color: var(--text); border-color: var(--border);
}
html[data-theme="dark"] .nav-tabs-custom > .nav-tabs > li.active { border-top-color: var(--primary); }
html[data-theme="dark"] .nav-tabs > li > a { color: var(--text-muted); }
html[data-theme="dark"] ::-webkit-scrollbar { width: 11px; height: 11px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #33465a; border-radius: 6px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #415774; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash .row { margin-bottom: 4px; }

/* KPI cards */
.kpi-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.kpi-blue   { background: linear-gradient(135deg, #3c8dbc 0%, #2f6f97 100%); }
.kpi-violet { background: linear-gradient(135deg, #8e6fd8 0%, #6f57c9 100%); }
.kpi-green  { background: linear-gradient(135deg, #24a367 0%, #1c8a56 100%); }
.kpi-red    { background: linear-gradient(135deg, #e5573f 0%, #c8412c 100%); }
.kpi-ico {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: rgba(255,255,255,.18);
  border-radius: 14px;
}
.kpi-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .9; }
.kpi-value { font-size: 26px; font-weight: 700; margin: 2px 0; white-space: nowrap; }
.kpi-sub { font-size: 12px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}

/* Chart cards */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.chart-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.chart-card-head h3 {
  margin: 0; font-size: 16px; font-weight: 600; color: var(--text);
}
.chart-card-head h3 small { color: var(--text-muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.echart { width: 100%; padding: 6px; }

/* Recent-transaction pills / badges */
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
}
.badge-in, .badge-out {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-in  { background: rgba(36,163,103,.15); color: #24a367; }
.badge-out { background: rgba(229,87,63,.15);  color: #e5573f; }

/* ---------- DataTables export buttons ---------- */
.dt-buttons-bar { margin-bottom: 12px; }
.dt-buttons { float: none; }
.dt-buttons .dt-button {
  margin-right: 6px;
  border-radius: var(--radius-sm) !important;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.dt-buttons .dt-button:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.dt-buttons .dt-button i { margin-right: 5px; }
.dt-buttons .dt-button.btn-success { background:#24a367; border-color:#1c8a56; color:#fff; }
.dt-buttons .dt-button.btn-danger  { background:#e5573f; border-color:#c8412c; color:#fff; }
.dt-buttons .dt-button.btn-primary { background:var(--primary); border-color:var(--primary-600); color:#fff; }
/* DataTables filter / length controls adopt themed inputs */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { min-width: 60px; }
/* Print window (new document) — nothing to theme, uses print.css from bundle */
