/* ==================================================
   Admin Theme — Bootstrap 5 custom styles
   ================================================== */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #3b82f6;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --topbar-height: 56px;
}

/* ---- Layout ---- */

body {
  font-size: 0.9375rem;
  background-color: #f1f5f9;
  overflow-x: hidden;
}

#admin-wrapper {
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.admin-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg) !important;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  transition: transform 0.25s ease, width 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.admin-content {
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
}

.sidebar-collapsed .admin-sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-collapsed .admin-content {
  margin-left: 0;
  max-width: 100vw;
}

.sidebar-header a {
  transition: opacity 0.15s;
}

.sidebar-header a:hover {
  opacity: 0.85;
}

/* Sidebar nav items */
.sidebar-nav .nav-item .nav-link {
  color: var(--sidebar-text);
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  margin-bottom: 0.125rem;
}

.sidebar-nav .nav-item .nav-link:hover {
  background: rgba(148, 163, 184, 0.14);
  color: var(--sidebar-text-active);
}

.sidebar-nav .nav-item.active > .nav-link,
.sidebar-nav .nav-item .nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.12));
  color: var(--sidebar-text-active);
  font-weight: 500;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.sidebar-nav .nav-item .nav-link .fa,
.sidebar-nav .nav-item .nav-link .fa-solid,
.sidebar-nav .nav-item .nav-link .fa-regular,
.sidebar-nav .nav-item .nav-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  padding-top: 0.75rem;
  padding-bottom: 0.25rem;
}

/* Sidebar accordion categories */
.sidebar-category {
  margin-bottom: 0.375rem;
}

.sidebar-nav .sidebar-category-toggle {
  color: #e2e8f0;
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav .sidebar-category-toggle:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--sidebar-text-active);
}

.sidebar-nav .sidebar-category-toggle.active,
.sidebar-nav .sidebar-category-toggle[aria-expanded="true"] {
  background: rgba(148, 163, 184, 0.08);
  color: #f8fafc !important;
  box-shadow: inset 2px 0 0 rgba(96, 165, 250, 0.95);
}

.sidebar-chevron {
  font-size: 0.625rem;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.15s ease;
}

.sidebar-category-toggle[aria-expanded="true"] .sidebar-chevron {
  transform: rotate(90deg);
  opacity: 1;
}

.sidebar-submenu {
  margin-top: 0.25rem;
  margin-left: 0.75rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar-submenu .nav-link {
  font-size: 0.84rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
}

.sidebar-submenu .nav-item .nav-link {
  color: #cbd5e1;
}

.sidebar-submenu .nav-item .nav-link:hover {
  transform: translateX(1px);
}

/* ---- Top navbar ---- */

.admin-content > .navbar {
  height: var(--topbar-height);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sidebar-toggle {
  border: none !important;
  box-shadow: none !important;
}

/* ---- Content area ---- */

.admin-content .p-4 {
  max-width: none;
}

/* ---- Flask-Admin table polish ---- */

.model-list {
  font-size: 0.8125rem;
}

.model-list th {
  white-space: nowrap;
  font-weight: 600;
  background: #f8fafc;
  font-size: 0.8125rem;
}

.model-list td {
  vertical-align: middle;
}

.list-buttons-column {
  white-space: nowrap;
}

.nav-tabs {
  margin-bottom: 1rem;
}

/* ---- Cards ---- */

.card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.card-header {
  background-color: #f8fafc;
  font-weight: 600;
}

/* Stat cards (dashboard) */
.stat-card {
  border: none;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-card .card-body {
  padding: 1.5rem;
}

.stat-card .stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* ---- Badges ---- */

.badge {
  font-weight: 500;
}

/* ---- Forms ---- */

.form-control:focus,
.form-select:focus {
  border-color: var(--sidebar-active);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

/* ---- Buttons ---- */

.btn {
  font-size: 0.875rem;
}

/* User menu (navbar): wide enough so Profile / Sign out stay on one line */
.admin-user-dropdown {
  min-width: 17.5rem;
}

/* User menu dropdown buttons (Profile / Sign out) */
.user-menu-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  border-radius: 0.5rem;
  white-space: nowrap;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- Alerts ---- */

.alert {
  border-radius: 0.5rem;
}

/* ---- Modals ---- */

.modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100vh - 1rem);
  margin: 0.5rem auto;
}

/* ---- Pagination ---- */

.pagination {
  gap: 0.125rem;
}

/* ==================================================
   Shared Design System
   Extracted from the Message Builder page for
   consistent use across all custom admin templates.
   ================================================== */

/* ---- Page wrapper ---- */

.admin-page {
  max-width: none;
}

.admin-page-narrow {
  max-width: 1100px;
}

/* ---- Hero section ---- */

/* Grid keeps breadcrumbs in the top-right column; flex-wrap was pushing the aside to a new full-width row, left-aligned. */
.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 575.98px) {
  .admin-hero {
    grid-template-columns: 1fr;
  }

  .admin-hero-aside {
    justify-self: end;
    max-width: 100%;
  }
}

.admin-hero h2 {
  margin: 0;
  font-weight: 700;
}

.admin-hero-subtitle {
  color: #64748b;
  margin-top: 0.375rem;
}

/* Breadcrumbs sit top-right in the hero (second grid column). */
.admin-hero-aside {
  justify-self: end;
  min-width: 0;
  max-width: min(100%, 42rem);
}

.admin-breadcrumb-nav {
  text-align: end;
}

.admin-breadcrumb-nav .breadcrumb {
  justify-content: flex-end;
}

/* ---- Admin card ---- */

.admin-card {
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.admin-card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.25rem;
}

.admin-card .card-header h5 {
  margin: 0;
  font-weight: 700;
}

.admin-card .card-body {
  padding: 1.25rem;
}

/* ---- Form styling ---- */

.admin-card .form-label {
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.375rem;
}

.admin-card .form-control,
.admin-card .form-select {
  border-radius: 0.75rem;
  border-color: #cbd5e1;
}

.admin-card select.form-control,
.admin-card .form-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  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='%2364748b' d='M6 8.825a.5.5 0 0 1-.354-.146L2.11 5.143a.5.5 0 0 1 .707-.707L6 7.618l3.182-3.182a.5.5 0 0 1 .707.707L6.354 8.679A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2rem;
}

.filter-hint {
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.35;
}

/* ---- Stat boxes ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.stats-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-box {
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 0.875rem 1rem;
  background: #fff;
}

.stat-box .label {
  color: #64748b;
  font-size: 0.8125rem;
}

.stat-box .value {
  margin-top: 0.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

/* ---- Count pill ---- */

.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: #ecfeff;
  color: #0f766e;
  font-weight: 600;
}

.count-pill--warning {
  background: #fff1f2;
  color: #be123c;
}

/* ---- Action bar ---- */

.admin-actionbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.admin-actionbar .btn {
  border-radius: 0.875rem;
}

.admin-helper {
  color: #64748b;
  font-size: 0.875rem;
}

/* ---- Option card (nested panel inside admin-card) ---- */

.option-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  background: #fff;
  padding: 1rem;
}

.option-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

/* ---- Model-view nav tabs (List / Create / Edit / Details) ---- */

.admin-page .nav-tabs {
  border: none;
  gap: 0.25rem;
  margin-bottom: 0;
}

.admin-page .nav-tabs .nav-link {
  border: none;
  border-radius: 0.625rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  transition: background 0.15s, color 0.15s;
}

.admin-page .nav-tabs .nav-link:hover {
  background: #f1f5f9;
  color: #334155;
}

.admin-page .nav-tabs .nav-link.active {
  background: #3b82f6;
  color: #fff;
}

/* ---- Bulk-edit tables (Wheel Prizes pattern: Currency Rates, Wheel Tiers, Currency Amounts) ---- */

.admin-card .admin-bulk-table {
  margin-bottom: 0;
  border: none;
  font-size: 0.8125rem;
}

/* Four-column rates editor: default width:100% splits the middle columns 50/50 and leaves a wide void */
.admin-card .admin-bulk-table.admin-currency-rates-table {
  width: auto;
  max-width: 100%;
}

.admin-card .admin-bulk-table thead th {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 2px solid #e2e8f0;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.admin-card .admin-bulk-table thead th small {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.admin-card .admin-bulk-table tbody td {
  padding: 0.35rem 0.75rem;
  vertical-align: middle;
  border-color: #f1f5f9;
  color: #334155;
}

.admin-card .admin-bulk-table tbody tr:hover {
  background: #f8fafc;
}

.admin-card .admin-bulk-table .form-control-sm,
.admin-card .admin-bulk-table .form-select-sm {
  border-radius: 0.5rem;
  border-color: #cbd5e1;
}

/* Bulk tables live inside forms; .admin-card form .form-control overrides .form-control-sm padding */
.admin-card form .admin-bulk-table .form-control-sm,
.admin-card form .admin-bulk-table select.form-control-sm {
  box-sizing: border-box;
  padding: 0.25rem 0.5rem;
  min-height: 2rem;
  max-height: none;
  line-height: 1.25;
  font-size: 0.8125rem;
}

.admin-card form .admin-bulk-table .form-check-input {
  margin-top: 0;
  width: 1rem;
  height: 1rem;
}

.admin-bulk-section-label {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

.admin-bulk-section-label .section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0;
}

/* ---- Model-view table inside admin-card ---- */

.admin-card .model-list {
  margin-bottom: 0;
  border: none;
  font-size: 0.8125rem;
}

.admin-card .model-list thead th {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 2px solid #e2e8f0;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

.admin-card .model-list thead th a {
  color: #475569;
  text-decoration: none;
}

.admin-card .model-list thead th a:hover {
  color: #1e293b;
}

.admin-card .model-list tbody td {
  padding: 0.625rem 1rem;
  vertical-align: middle;
  border-color: #f1f5f9;
  color: #334155;
}

.admin-card .model-list tbody tr:hover {
  background: #f8fafc;
}

.admin-card .model-list tbody tr:last-child td {
  border-bottom: none;
}

.admin-card .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.admin-card > .table-responsive:last-child {
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ---- Model-view list action buttons (edit/delete/details icons) ---- */

.list-buttons-column {
  white-space: nowrap;
  padding: 0.5rem 0.75rem;
}

.list-buttons-column a.icon,
.list-buttons-column form.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: #64748b;
  transition: background 0.15s, color 0.15s;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.list-buttons-column form.icon button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: #64748b;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.list-buttons-column a.icon:hover,
.list-buttons-column form.icon button:hover {
  background: #f1f5f9;
  color: #3b82f6;
}

/* ---- Model-view form (edit / create) inside admin-card ---- */

.admin-card form .form-group {
  margin-bottom: 1.25rem;
}

.admin-card form .control-label {
  font-weight: 600;
  color: #334155;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
}

.admin-card form .form-control {
  border-radius: 0.75rem;
  border-color: #cbd5e1;
  padding: 0.5rem 0.875rem;
}

.admin-card form .form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.admin-card form .form-select,
.admin-card form select.form-control {
  border-radius: 0.75rem;
  border-color: #cbd5e1;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  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='%2364748b' d='M6 8.825a.5.5 0 0 1-.354-.146L2.11 5.143a.5.5 0 0 1 .707-.707L6 7.618l3.182-3.182a.5.5 0 0 1 .707.707L6.354 8.679A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2rem;
}

.admin-card form .help-block {
  color: #64748b;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  line-height: 1.35;
}

.admin-card form .btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
  border-radius: 0.75rem;
  padding: 0.5rem 1.5rem;
  font-weight: 600;
}

.admin-card form .btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.admin-card form .btn-danger {
  border-radius: 0.75rem;
}

/* ---- Pagination inside admin-card ---- */

.admin-card .pagination {
  margin: 1rem 1.25rem;
  gap: 0.25rem;
}

.admin-card .pagination .page-link {
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
}

.admin-card .pagination .page-item.active .page-link {
  background: #3b82f6;
  border-color: #3b82f6;
}

/* ---- Filter pills (always-visible filter buttons) ---- */

.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.filter-pills-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-right: 0.25rem;
}

a.filter-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}

a.filter-pill:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
}

/* ---- Active filter form area ---- */

.filter-form-area {
  border-top: 1px solid #e2e8f0;
  padding: 0.75rem 1.25rem;
}

.filter-form-area:empty,
.filter-form-area:not(:has(tr)) {
  display: none;
}

.filter-form-area form {
  margin: 0;
}

.filter-form-area table.filters {
  width: 100%;
  border: none;
}

.filter-form-area table.filters tr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
}

.filter-form-area table.filters tr + tr {
  border-top: 1px solid #f1f5f9;
}

.filter-form-area table.filters td {
  display: inline-flex;
  align-items: center;
  border: none;
  padding: 0;
}

.filter-form-area .remove-filter {
  font-size: 0.8125rem;
  border-radius: 0.5rem;
  padding: 0.25rem 0.625rem;
}

.filter-form-area .filter-op,
.filter-form-area .filter-val {
  font-size: 0.8125rem;
  border-radius: 0.5rem !important;
}

.filter-form-area .pull-right {
  float: none !important;
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.filter-form-area .pull-right .btn {
  border-radius: 0.625rem;
  font-size: 0.8125rem;
}

.filter-form-area .clearfix {
  display: none;
}

/* ---- Toolbar search form ---- */

.admin-card form.form-inline {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
}

.admin-card form.form-inline .form-inline,
.admin-card form.form-inline .input-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 0;
}

.admin-card form.form-inline .form-control {
  border-radius: 0.625rem 0 0 0.625rem;
  border-color: #cbd5e1;
  font-size: 0.875rem;
  border-right: none;
}

.admin-card form.form-inline .btn {
  border-radius: 0 0.625rem 0.625rem 0;
  font-size: 0.875rem;
  white-space: nowrap;
  margin-left: 0 !important;
}

/* ---- Toolbar dropdown links ---- */

.admin-card .dropdown > .nav-link {
  font-size: 0.8125rem;
  color: #475569;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.admin-card .dropdown > .nav-link:hover {
  background: #f8fafc;
}

/* ---- Details table ---- */

.admin-card .table.searchable {
  margin-bottom: 0;
  border: none;
}

.admin-card .table.searchable td {
  padding: 0.75rem 1.25rem;
  border-color: #f1f5f9;
  vertical-align: top;
}

.admin-card .table.searchable td:first-child {
  width: 220px;
  color: #64748b;
  font-size: 0.8125rem;
  background: #fafbfc;
}

.admin-card .table.searchable td:first-child b {
  font-weight: 600;
  color: #475569;
}

/* ---- Empty list state ---- */

.admin-card .model-list .text-center {
  padding: 2rem 1rem;
  color: #94a3b8;
}

/* ---- Select2 inside admin-card ---- */

.select2-container--default .select2-selection--single,
.admin-card .select2-container--default .select2-selection--single {
  border-radius: 0.75rem;
  border-color: #cbd5e1;
  height: 38px;
  padding: 0.25rem 0.5rem;
  background-image: none;
}

.select2-container--default .select2-selection--multiple,
.admin-card .select2-container--default .select2-selection--multiple {
  border-radius: 0.75rem;
  border-color: #cbd5e1;
  background-image: none;
}

select.select2-hidden-accessible {
  display: none !important;
}

.select2-container {
  display: block !important;
}

/* ---- Responsive admin-page ---- */

@media (max-width: 991.98px) {
  .admin-hero {
    flex-direction: column;
  }

  .stats-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Auth pages (login/register) ---- */

.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.auth-card {
  max-width: 420px;
  width: 100%;
  border: none;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.auth-card .card-body {
  padding: 2.5rem;
}

/* ==================================================
   BS4 → BS5 Compatibility Aliases
   Flask-Admin's bootstrap4 templates use some BS4-only
   utility classes. These aliases ensure they render
   correctly under Bootstrap 5.
   ================================================== */

.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }
.ml-auto { margin-left: auto !important; }

.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mr-5 { margin-right: 3rem !important; }
.mr-auto { margin-right: auto !important; }

.pl-0 { padding-left: 0 !important; }
.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pr-0 { padding-right: 0 !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pr-3 { padding-right: 1rem !important; }

.float-left { float: left !important; }
.float-right { float: right !important; }

.pull-left { float: left !important; }
.pull-right { float: right !important; }

.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.font-weight-bold { font-weight: 700 !important; }
.font-weight-normal { font-weight: 400 !important; }

/* BS4 form-inline (removed in BS5) */
.form-inline {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 0.5rem;
}

/* BS4 input-group-prepend/append wrappers (removed in BS5) */
.input-group-prepend,
.input-group-append {
  display: contents;
}

/* BS4 close button compat */
button.close {
  background: transparent;
  border: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.5;
  padding: 0;
}

button.close:hover {
  opacity: 0.75;
}

/* BS3 hidden-xs (used in my_master) */
.hidden-xs {
  display: inline !important;
}

/* ---- List filters: uniform sm control height (text, date, select, buttons) ----
   .admin-card form .form-control sets large padding above; that hits text inputs but
   not .form-select the same way, so inputs looked taller than selects/dates. Force
   Bootstrap-sm padding + fixed height so every control matches. */
form.admin-toolbar-controls .form-control-sm,
form.admin-toolbar-controls .form-select-sm {
  box-sizing: border-box;
  height: 2.125rem;
  min-height: 2.125rem;
  max-height: 2.125rem;
  font-size: 0.875rem;
  line-height: 1.25;
}

form.admin-toolbar-controls .form-control-sm {
  padding: 0.25rem 0.5rem;
}

form.admin-toolbar-controls .form-select-sm {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 0.5rem;
  padding-right: 2rem;
}

form.admin-toolbar-controls input.form-control-sm[type="date"],
form.admin-toolbar-controls input.form-control-sm[type="time"],
form.admin-toolbar-controls input.form-control-sm[type="datetime-local"] {
  padding: 0.25rem 0.5rem;
  line-height: 1.25;
}

form.admin-toolbar-controls .btn-sm {
  height: 2.125rem;
  min-height: 2.125rem;
  max-height: 2.125rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

/* ---- Responsive ---- */

@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .admin-content {
    margin-left: 0;
  }

  #admin-wrapper:not(.sidebar-collapsed) .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  #admin-wrapper.sidebar-show .admin-sidebar {
    transform: translateX(0);
  }

  .hidden-xs {
    display: none !important;
  }
}

@media (min-width: 992px) {
  .sidebar-collapsed .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .sidebar-collapsed .admin-content {
    margin-left: 0;
  }
}

.sticky-top {
  z-index: 10;
}