/* ================================
   UHF Theme (Mobile-friendly)
   Drop-in replacement
   ================================ */

:root {
  --uhf-blue: #1f5eff;
  --uhf-blue-2: #0f3fbf;
  --uhf-bg: #f6f8fc;
  --uhf-card: #ffffff;
  --uhf-text: #0f172a;
  --uhf-muted: #64748b;
  --uhf-border: #e6eaf2;
  --radius: 10px;

  /* layout helpers */
  --sidebar-w: 240px;
  --topbar-h: 50px;
}

/* Basic */
html,
body {
  height: 100%;
}

body {
  background: var(--uhf-bg);
  color: var(--uhf-text);
  -webkit-text-size-adjust: 100%;
  font-size: 0.8125rem;
  /* 13px */
}

/* Ensure media doesn’t overflow */
img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--uhf-card);
  border-right: 1px solid var(--uhf-border);
  padding: 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f2f6ff, #ffffff);
  border: 1px solid var(--uhf-border);
  margin-bottom: 16px;
}

.logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--uhf-blue);
  box-shadow: 0 0 0 6px rgba(31, 94, 255, .12);
}

.brand-title {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .2px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--uhf-muted);
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav .nav-item {
  text-decoration: none;
  color: var(--uhf-text);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  /* touch friendly */
  text-transform: capitalize;
  font-weight: 500;
}

.sidebar-nav .nav-item:hover {
  background: #f2f6ff;
  border-color: var(--uhf-border);
}

.sidebar-nav .nav-item.active {
  background: #eaf0ff;
  border-color: #d6e2ff;
  color: var(--uhf-blue-2);
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* important for tables overflow */
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 248, 252, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--uhf-border);
  padding: 8px 12px;
  min-height: var(--topbar-h);

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  /* mobile wrap */
}

.badge-soft {
  background: #eaf0ff;
  color: var(--uhf-blue-2);
  border: 1px solid #d6e2ff;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
  text-transform: capitalize;
}

/* Content */
.content-wrap {
  padding: 14px 14px 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  /* mobile wrap */
}

.page-title {
  font-size: 18px;
  font-weight: 800;
  text-transform: capitalize;
}

.page-subtitle {
  font-size: 13px;
  color: var(--uhf-muted);
  text-transform: none;
}

.card-soft {
  border: 1px solid var(--uhf-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(2, 8, 23, .04);
}

/* Bootstrap polish */
.btn-primary {
  background: var(--uhf-blue);
  border-color: var(--uhf-blue);
}

.btn-primary:hover {
  background: var(--uhf-blue-2);
  border-color: var(--uhf-blue-2);
}

.accordion-button,
.dropdown-item,
.nav-link,
.form-label,
.fw-bold {
  text-transform: capitalize !important;
}

.btn,
.form-control,
.form-select {
  -webkit-tap-highlight-color: transparent;
  text-transform: none;
  border-radius: 10px;
  font-size: 0.825rem;
}

.btn {
  text-transform: capitalize;
}

.form-label {
  font-weight: 700;
  color: #0b1b44;
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: var(--uhf-border);
  padding: 10px 12px;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(31, 94, 255, .45);
  box-shadow: 0 0 0 .25rem rgba(31, 94, 255, .12);
}

/* Tables */
.table {
  vertical-align: middle;
  font-size: 12px;
}

.table th,
.table td {
  padding: 5px 8px;
  white-space: nowrap;
}

.table th {
  text-transform: capitalize;
  font-weight: 600;
  color: var(--uhf-muted);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ================================
   DataTables polish (Bootstrap 5)
   ================================ */

.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Put filter + length nicely on small screens */
.dataTables_wrapper .row {
  margin-left: 0;
  margin-right: 0;
}

/* Inputs */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border-radius: 12px !important;
  border-color: var(--uhf-border) !important;
  padding: .4rem .6rem;
}

/* Length dropdown fix (Show 10 / 25 / 50) */
.dataTables_wrapper .dataTables_length label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_length select {
  height: 34px;
  line-height: 34px;
  padding: 0.25rem 2.25rem 0.25rem 0.75rem;
  /* arrow room */
  border-radius: 10px;
  border: 1px solid rgba(13, 110, 253, 0.20);
  background-color: #fff;
  background-position: right .75rem center;
  background-size: 16px 16px;
}

.dataTables_wrapper .dataTables_length label::after,
.dataTables_wrapper .dataTables_length label::before {
  content: none !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: 0.925rem;
}

/* Pagination: keep it usable on mobile */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: .25rem .55rem !important;
  margin: 0 .1rem !important;
}

/* ================================
   Mobile Responsive Sidebar
   ================================ */

@media (max-width: 992px) {

  :root {
    --sidebar-w: 290px;
  }

  .content-wrap {
    padding: 14px 12px 22px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform .18s ease;
    z-index: 999;
    box-shadow: 0 20px 50px rgba(2, 8, 23, .18);
    width: var(--sidebar-w);
  }

  /* open state controlled by JS: .app-shell.sidebar-open */
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* optional overlay (if you add it in HTML/JS) */
  .app-shell.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 23, .35);
    z-index: 998;
  }

  .topbar {
    padding: 10px 12px;
  }

  .page-title {
    font-size: 18px;
  }

  .page-subtitle {
    font-size: 12.5px;
  }

  /* Make dropdown button not overflow */
  .topbar-right .dropdown .btn {
    max-width: 72vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* DataTables filter/length stack nicely */
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    text-align: left !important;
    margin-bottom: .5rem;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Extra-small tweaks */
@media (max-width: 576px) {

  .sidebar {
    padding: 14px;
  }

  .sidebar-brand {
    padding: 10px;
  }

  .sidebar-nav .nav-item {
    padding: 10px 10px;
    min-height: 44px;
  }

  .badge-soft {
    padding: 6px 9px;
  }

  .card-soft {
    border-radius: 12px;
  }

  /* Slightly tighter table on mobile */
  .table td,
  .table th {
    padding: .55rem .55rem;
  }
}