/* ============================================================
   HMS Ghana — Turquoise Design System
   ============================================================ */

/* Fonts are self-hosted — see assets/vendor/fonts/fonts.css, loaded separately before this file. */

:root {
  /* Brand palette — turquoise */
  --hms-primary:        #0d9488;
  --hms-primary-rgb:    13,148,136;
  --hms-primary-dark:   #0f766e;
  --hms-primary-darker: #0b3d3a;
  --hms-primary-light:  #2dd4bf;
  --hms-primary-pale:   #ccfbf1;
  --hms-accent:         #f6b93b;

  /* Bootstrap overrides */
  --bs-primary:          var(--hms-primary);
  --bs-primary-rgb:      var(--hms-primary-rgb);
  --bs-link-color:       var(--hms-primary);
  --bs-link-color-rgb:   var(--hms-primary-rgb);
  --bs-link-hover-color: var(--hms-primary-dark);
  --bs-focus-ring-color: rgba(13,148,136,.25);

  /* Layout */
  --hms-sidebar-bg-start: #0b3d3a;
  --hms-sidebar-bg-end:   #082220;
  --hms-sidebar-text:     #9fc9c4;
  --hms-sidebar-hover:    rgba(255,255,255,.08);
  --hms-sidebar-active:   #2dd4bf;
  --hms-topbar-start:     #0fae9e;
  --hms-topbar-end:       #0d7a6e;
  --hms-topbar-height:    60px;
  --hms-sidebar-width:    264px;
  --hms-sidebar-collapsed-width: 72px;
  --hms-main-bg:          #f3f9f8;
  --hms-card-shadow:      0 4px 18px rgba(11,61,58,.08);
  --hms-card-shadow-lg:   0 12px 32px rgba(11,61,58,.14);
  --hms-radius:           14px;
  --hms-radius-sm:        9px;
}

/* ── Base ──────────────────────────────────────────────────── */
body {
  background: var(--hms-main-bg);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: .875rem;
  color: #1b2c2a;
}
h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold { font-family: 'Poppins', 'Inter', sans-serif; }

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(13,148,136,.25); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(13,148,136,.45); }

/* ── Topbar ────────────────────────────────────────────────── */
.hms-topbar {
  background: linear-gradient(110deg, var(--hms-topbar-start), var(--hms-topbar-end));
  height: var(--hms-topbar-height);
  z-index: 1040;
  box-shadow: 0 2px 14px rgba(11,61,58,.18);
}
.hms-topbar .navbar-brand { font-family: 'Poppins', sans-serif; letter-spacing: .2px; }
.hms-topbar .btn-outline-light { border-color: rgba(255,255,255,.4); }
.hms-topbar .btn-outline-light:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.6); }
.hms-topbar .badge.bg-light.text-primary { color: var(--hms-primary) !important; font-weight: 700; }
.global-search { position: relative; width: min(440px, 34vw); }
.global-search .input-group-text {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.25);
  color: rgba(255,255,255,.9);
}
.global-search .form-control {
  background: rgba(255,255,255,.92);
  border-color: rgba(255,255,255,.28);
  font-size: .8rem;
}
.global-search .form-control:focus {
  background: #fff;
  box-shadow: 0 0 0 .18rem rgba(255,255,255,.22);
}
.global-search-results {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .45rem);
  z-index: 1060;
  max-height: 440px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dcecea;
  border-radius: var(--hms-radius-sm);
}
.global-search-results.show { display: block; }
.global-search-item {
  padding: .75rem;
  border-bottom: 1px solid #e6f1ef;
  cursor: pointer;
}
.global-search-item:last-child { border-bottom: 0; }
.global-search-item:hover { background: rgba(13,148,136,.06); }
.global-search-empty { padding: .9rem; text-align: center; color: #6b8b87; font-size: .8rem; }

.hms-wrapper { display: flex; padding-top: var(--hms-topbar-height); min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.hms-sidebar {
  width: var(--hms-sidebar-width);
  min-width: var(--hms-sidebar-width);
  background: linear-gradient(195deg, var(--hms-sidebar-bg-start), var(--hms-sidebar-bg-end));
  position: fixed;
  top: var(--hms-topbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease, width .25s ease, min-width .25s ease;
  z-index: 1030;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.hms-sidebar.collapsed {
  width: var(--hms-sidebar-collapsed-width);
  min-width: var(--hms-sidebar-collapsed-width);
  transform: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: 1.25rem 1.25rem .75rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: var(--hms-primary-light) !important; }
.hms-sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.hms-sidebar.collapsed .sidebar-brand span { display: none; }

.sidebar-nav { padding: .5rem 0 5rem; }
.sidebar-nav .nav-section-label {
  padding: 1rem 1.25rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(255,255,255,.32);
  text-transform: uppercase;
  pointer-events: none;
}
.sidebar-nav .nav-subsection-label {
  padding: .7rem 1.25rem .18rem;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(45,212,191,.78);
  text-transform: uppercase;
  pointer-events: none;
}
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .55rem 1.25rem;
  color: var(--hms-sidebar-text);
  border-radius: 0;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.sidebar-nav .nav-link:hover { background: var(--hms-sidebar-hover); color: #fff; }
.sidebar-nav .nav-link:hover .nav-icon { color: var(--hms-primary-light); }
.sidebar-nav .nav-link.active {
  background: rgba(45,212,191,.16);
  color: #fff;
  border-left: 3px solid var(--hms-sidebar-active);
  font-weight: 600;
  padding-left: calc(1.25rem - 3px);
  box-shadow: inset 0 0 18px rgba(45,212,191,.08);
}
.sidebar-nav .nav-link.active .nav-icon { color: var(--hms-sidebar-active); }
.nav-icon { width: 1rem; text-align: center; font-size: .875rem; flex-shrink: 0; }
.hms-sidebar.collapsed .sidebar-nav .nav-section-label,
.hms-sidebar.collapsed .sidebar-nav .nav-subsection-label {
  display: none;
}
.hms-sidebar.collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
  min-height: 2.75rem;
}
.hms-sidebar.collapsed .sidebar-nav .nav-link.active {
  border-left: 0;
  border-right: 3px solid var(--hms-sidebar-active);
  padding-left: 0;
}
.hms-sidebar.collapsed .sidebar-nav .nav-link span,
.hms-sidebar.collapsed .sidebar-group-chevron {
  display: none;
}
.hms-sidebar.collapsed .sidebar-group-toggle > span {
  justify-content: center;
}
.hms-sidebar.collapsed .sidebar-subnav,
.hms-sidebar.collapsed .sidebar-subnav.collapse {
  display: block !important;
  height: auto !important;
  visibility: visible !important;
  margin: 0;
}
.hms-sidebar.collapsed .sidebar-subnav .nav-link {
  font-size: .875rem;
}
.sidebar-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  justify-content: space-between;
}
.sidebar-group-toggle > span {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-width: 0;
}
.sidebar-group-chevron {
  font-size: .68rem;
  color: rgba(255,255,255,.42);
  transition: transform .18s ease, color .15s ease;
}
.sidebar-group-toggle:not(.collapsed) .sidebar-group-chevron {
  transform: rotate(180deg);
  color: var(--hms-primary-light);
}
.sidebar-subnav {
  list-style: none;
  padding-left: 0;
  margin: .1rem 0 .35rem;
}
.sidebar-subnav .nav-link {
  padding-left: 2.65rem;
  font-size: .92rem;
  color: rgba(224,247,243,.72);
}
.sidebar-subnav .nav-link.active {
  padding-left: calc(2.65rem - 3px);
}

.sidebar-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: var(--hms-sidebar-width);
  padding: .75rem 1rem;
  background: var(--hms-sidebar-bg-end);
  border-top: 1px solid rgba(255,255,255,.08);
}
.hms-sidebar.collapsed .sidebar-footer {
  width: var(--hms-sidebar-collapsed-width);
  padding: .75rem .85rem;
}
.hms-sidebar.collapsed .sidebar-footer .btn {
  width: 2.5rem !important;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}
.hms-sidebar.collapsed .sidebar-footer .btn i {
  margin: 0 !important;
  font-size: .95rem;
}

/* ── Main content ──────────────────────────────────────────── */
.hms-main {
  flex: 1;
  margin-left: var(--hms-sidebar-width);
  transition: margin-left .25s ease;
  min-width: 0;
  min-height: calc(100vh - var(--hms-topbar-height));
  display: flex;
  flex-direction: column;
}
.hms-main.expanded { margin-left: var(--hms-sidebar-collapsed-width); }
.hms-content { flex: 1 0 auto; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--hms-radius);
  box-shadow: var(--hms-card-shadow);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card-header {
  background: #fff;
  border-bottom: 1px solid #e6f1ef;
  font-weight: 600;
  border-radius: var(--hms-radius) var(--hms-radius) 0 0 !important;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card { border-radius: var(--hms-radius); padding: 1.25rem; color: #fff !important; position: relative; overflow: hidden; box-shadow: var(--hms-card-shadow-lg); transition: transform .2s ease; }
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-icon { display: none !important; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; font-family: 'Poppins', sans-serif; color: #fff !important; text-shadow: 0 1px 1px rgba(0,0,0,.14); }
.stat-card .stat-label { font-size: .8rem; opacity: .96; margin-top: .25rem; color: #fff !important; text-shadow: 0 1px 1px rgba(0,0,0,.14); }
.stat-card .stat-change { font-size: .75rem; margin-top: .5rem; color: #fff !important; }
.bg-gradient-primary { background: linear-gradient(135deg, #0fae9e, #0b6e63) !important; }
.bg-gradient-success { background: linear-gradient(135deg, #22c55e, #15803d) !important; }
.bg-gradient-warning { background: linear-gradient(135deg, #f59e0b, #b45309) !important; }
.bg-gradient-danger  { background: linear-gradient(135deg, #ef4444, #b91c1c) !important; }
.bg-gradient-info    { background: linear-gradient(135deg, #22d3ee, #0891b2) !important; }
.bg-gradient-secondary { background: linear-gradient(135deg, #475569, #1f2937) !important; }
.bg-gradient-purple  { background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important; }
.bg-gradient-teal    { background: linear-gradient(135deg, #2dd4bf, #0d9488) !important; }
.bg-gradient-orange  { background: linear-gradient(135deg, #fb923c, #c2620a) !important; }

.card-header i.fas,
.card-header i.fa-solid {
  opacity: .72;
}

.hms-main .bg-white > .d-flex h4 > i.fas:first-child,
.hms-main .bg-white > .d-flex h4 > i.fa-solid:first-child,
.hms-main .bg-white > div h4 > i.fas:first-child,
.hms-main .bg-white > div h4 > i.fa-solid:first-child {
  display: none !important;
}

.hms-main .card .card-body > .d-flex > i.fa-2x,
.hms-main .card .card-body .d-flex > i.fa-2x {
  display: none !important;
}

/* ── Bootstrap "primary" retheme ──────────────────────────── */
.btn-primary {
  --bs-btn-bg: var(--hms-primary);
  --bs-btn-border-color: var(--hms-primary);
  --bs-btn-hover-bg: var(--hms-primary-dark);
  --bs-btn-hover-border-color: var(--hms-primary-dark);
  --bs-btn-active-bg: var(--hms-primary-dark);
  --bs-btn-active-border-color: var(--hms-primary-dark);
  --bs-btn-disabled-bg: var(--hms-primary);
  --bs-btn-disabled-border-color: var(--hms-primary);
  --bs-btn-focus-shadow-rgb: var(--hms-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--hms-primary);
  --bs-btn-border-color: var(--hms-primary);
  --bs-btn-hover-bg: var(--hms-primary);
  --bs-btn-hover-border-color: var(--hms-primary);
  --bs-btn-active-bg: var(--hms-primary);
  --bs-btn-active-border-color: var(--hms-primary);
  --bs-btn-focus-shadow-rgb: var(--hms-primary-rgb);
}
.btn, .btn-sm { border-radius: var(--hms-radius-sm); font-weight: 600; }
.btn-login, .btn-lg { border-radius: 10px; }
.text-primary { color: var(--hms-primary) !important; }
.bg-primary   { background-color: var(--hms-primary) !important; }
.border-primary { border-color: var(--hms-primary) !important; }
.form-check-input:checked { background-color: var(--hms-primary); border-color: var(--hms-primary); }
.page-link { color: var(--hms-primary); }
.page-item.active .page-link { background-color: var(--hms-primary); border-color: var(--hms-primary); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: var(--hms-primary); }
.dropdown-item.active, .dropdown-item:active { background-color: var(--hms-primary); }
.dropdown-menu { border-radius: var(--hms-radius-sm); border: 1px solid #e6f1ef; }
.progress-bar { background-color: var(--hms-primary); }
.spinner-border.text-primary { color: var(--hms-primary) !important; }

/* ── Tables ────────────────────────────────────────────────── */
.table-hover tbody tr:hover { background: rgba(13,148,136,.05); }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #5b7d79; font-weight: 600; white-space: nowrap; }
.table-light, thead.table-light th { background-color: #eef8f6 !important; }
.hms-data-table thead th {
  background: #eef8f6 !important;
  border-bottom: 1px solid #d7eae7;
  color: #31534f;
}
.hms-data-table td { vertical-align: middle; }
.hms-data-table .btn-group-sm > .btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dataTables_wrapper .dataTables_filter input { border-radius: var(--hms-radius-sm); border: 1px solid #d7eae7; padding: .3rem .6rem; }
.dataTables_wrapper .dataTables_length select { border-radius: var(--hms-radius-sm); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: .8rem; color: #2f4a47; }
.form-control, .form-select { border-radius: var(--hms-radius-sm); border-color: #d7eae7; }
.form-control:focus, .form-select:focus { border-color: var(--hms-primary); box-shadow: 0 0 0 .2rem rgba(13,148,136,.15); }
.required-mark { color: #dc3545; }
.section-divider { border-top: 2px solid #e6f1ef; margin: 1.5rem 0 1rem; }
.section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #5b7d79; margin-bottom: .75rem; }
.hms-filter-panel {
  background: #fff;
  border: 1px solid #e1efed;
  border-radius: var(--hms-radius);
  box-shadow: var(--hms-card-shadow);
  padding: .85rem;
  margin-bottom: 1rem;
}
.hms-filter-panel .form-control-sm,
.hms-filter-panel .form-select-sm {
  min-height: 2.15rem;
}
.hms-filter-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.hms-filter-actions .btn {
  min-height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge { font-size: .7rem; font-weight: 600; padding: .3em .6em; border-radius: 5px; }
.hms-status-badge {
  letter-spacing: 0;
  white-space: nowrap;
}

/* ── Patient Card / Profile ────────────────────────────────── */
.patient-avatar { width: 80px; height: 80px; object-fit: cover; border-radius: 50%; border: 3px solid #e6f1ef; }
.patient-avatar-placeholder { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg,#0fae9e,#0b6e63); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; }
.info-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #5b7d79; font-weight: 600; }
.info-value { font-size: .9rem; font-weight: 500; color: #1b2c2a; }

/* ── Queue / Status Indicators ─────────────────────────────── */
.triage-red    { background: #dc3545 !important; color: #fff !important; }
.triage-orange { background: #fd7e14 !important; color: #fff !important; }
.triage-yellow { background: #ffc107 !important; color: #000 !important; }
.triage-green  { background: #198754 !important; color: #fff !important; }

/* ── Bed Grid ──────────────────────────────────────────────── */
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
.bed-item { border-radius: 8px; padding: .75rem .5rem; text-align: center; font-size: .75rem; font-weight: 600; border: 2px solid transparent; cursor: pointer; transition: transform .15s; }
.bed-item:hover { transform: translateY(-2px); }
.bed-available  { background: #d1f5ea; border-color: #0d9488; color: #0a3622; }
.bed-occupied   { background: #f8d7da; border-color: #dc3545; color: #58151c; }
.bed-reserved   { background: #fff3cd; border-color: #ffc107; color: #664d03; }
.bed-maintenance{ background: #e2e3e5; border-color: #adb5bd; color: #41464b; }

/* ── Footer ────────────────────────────────────────────────── */
.hms-footer {
  flex-shrink: 0;
  margin-top: 1.5rem;
  padding: 1rem 0;
  color: #557974;
  text-align: center;
  font-size: .82rem;
  background: rgba(255,255,255,.48);
  border-top: 1px solid #dcecea;
  box-shadow: 0 -8px 24px rgba(11,61,58,.035);
}
.hms-footer .container-fluid {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 1.75rem;
}

/* ── Print styles ──────────────────────────────────────────── */
@media print {
  .hms-sidebar, .hms-topbar, .hms-footer, .btn, .no-print { display: none !important; }
  .hms-main { margin-left: 0 !important; }
  .card { box-shadow: none !important; }
  body { background: #fff; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .hms-sidebar { transform: translateX(-100%); }
  .hms-sidebar.collapsed {
    width: var(--hms-sidebar-width);
    min-width: var(--hms-sidebar-width);
    transform: translateX(-100%);
  }
  .hms-sidebar.show { transform: translateX(0); }
  .hms-main { margin-left: 0; }
  .hms-main.expanded { margin-left: 0; }
  .hms-filter-actions,
  .hms-filter-actions .btn { width: 100%; }
  .hms-data-table .btn-group-sm > .btn {
    width: 2.25rem;
    height: 2.25rem;
  }
}
