:root {
  --navy: #101a3d;
  --navy-light: #182451;
  --teal: #0ea5a0;
  --teal-dark: #0b8883;
  --pink: #ec4899;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --orange: #f59e0b;
  --red: #ef4444;
  --green: #10b981;
  --bg: #f4f6fb;
  --text-muted: #6b7280;
  --border: #e7e9f0;
  --card-radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'Poppins', 'Segoe UI', Roboto, Arial, sans-serif;
  color: #1f2338;
}

a { text-decoration: none; }

/* ---------- App Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #05060b;
  color: #cfd6ef;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1030;
}

.sidebar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  background: #05060b;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  width: 100%;
  height: auto;
  display: block;
}

/* Only this wrapper scrolls — the logo/brand header above stays fixed in place */
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sidebar-brand .heart-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--pink), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.sidebar-brand small { display: block; font-size: .62rem; color: #97a0c7; font-weight: 400; letter-spacing: .3px; }

.sidebar-section-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6f79a6;
  padding: 16px 22px 6px;
}

.sidebar-nav { list-style: none; margin: 0; padding: 6px 12px; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #c4cbe8;
  font-size: .92rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(14,165,160,.35); }

/* ---------- Main content ---------- */
.main-content { margin-left: 260px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  position: sticky; top: 0; z-index: 1020;
}
.topbar .search-box {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.topbar .search-box input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 9px 14px 9px 38px;
  font-size: .9rem;
}
.topbar .search-box i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 18px; }
.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: #333; font-size: 1.05rem;
  border: none;
}
.icon-btn .badge-dot {
  position: absolute; top: -3px; right: -3px;
  background: var(--red); color: #fff;
  font-size: .62rem; font-weight: 700;
  border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.profile-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.profile-chip .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.profile-chip .name { font-weight: 600; font-size: .88rem; line-height: 1.1; }
.profile-chip .role { font-size: .72rem; color: var(--text-muted); }

.page-body { padding: 24px 28px 60px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-header .subtitle { color: var(--text-muted); font-size: .85rem; }

/* ---------- Cards ---------- */
.card-tile {
  background: #fff;
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(16,26,61,.04);
}
.stat-card { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-card .stat-label { color: var(--text-muted); font-size: .8rem; font-weight: 500; }
.stat-card .stat-value { font-size: 1.55rem; font-weight: 700; margin-top: 4px; }
.stat-card .stat-delta { font-size: .76rem; margin-top: 6px; font-weight: 600; }
.stat-card .stat-delta.up { color: var(--green); }
.stat-card .stat-delta.down { color: var(--red); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.blue { background: #e8f0fe; color: var(--blue); }
.stat-icon.green { background: #e6f9f1; color: var(--green); }
.stat-icon.purple { background: #f1ebfe; color: var(--purple); }
.stat-icon.orange { background: #fef3e2; color: var(--orange); }
.stat-icon.red { background: #fdeaea; color: var(--red); }

.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title-row h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.card-title-row a { font-size: .82rem; color: var(--teal-dark); font-weight: 600; }

/* ---------- Tables ---------- */
.table-clean { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table-clean thead th {
  text-align: left; color: var(--text-muted); font-weight: 600;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.table-clean tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-clean tbody tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover { background: #fafbff; }

.avatar-sm {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; margin-right: 10px;
}

/* ---------- Badges / status pills ---------- */
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.pill-green { background: #e6f9f1; color: #0a9463; }
.pill-blue { background: #e8f0fe; color: #1d5fd6; }
.pill-red { background: #fdeaea; color: #d92d2d; }
.pill-yellow { background: #fef7e0; color: #b5820a; }
.pill-gray { background: #eef0f6; color: #5b6280; }
.pill-purple { background: #f1ebfe; color: #6f3fd9; }

/* ---------- Buttons ---------- */
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-outline-teal { border: 1px solid var(--teal); color: var(--teal-dark); background: #fff; }
.btn-outline-teal:hover { background: var(--teal); color: #fff; }

/* ---------- Forms ---------- */
.form-card { background: #fff; border-radius: var(--card-radius); border: 1px solid var(--border); padding: 26px; }
.form-label { font-weight: 600; font-size: .84rem; }

/* ---------- Quick action tiles ---------- */
.quick-action {
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  display: block;
  transition: transform .12s;
}
.quick-action:hover { transform: translateY(-2px); }
.quick-action i { font-size: 1.4rem; display: block; margin-bottom: 8px; }
.quick-action span { font-size: .8rem; font-weight: 600; color: #1f2338; }

/* ---------- Login page ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1c2a5e 60%, var(--teal-dark) 140%);
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  width: 100%; max-width: 400px;
  padding: 38px 34px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-card .heart-icon {
  width: 54px; height: 54px; border-radius: 14px;
  background: linear-gradient(135deg, var(--pink), var(--teal));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 14px;
}
.auth-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 10px;
}

/* ---------- Sortable table headers ---------- */
.table-clean thead th a.sort-link {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.table-clean thead th a.sort-link:hover { color: var(--teal-dark); }
.sort-icon { font-size: .65rem; }
.sort-icon.active { color: var(--teal); }
.sort-icon:not(.active) { opacity: .35; }

.table-responsive { border-radius: 4px; }

/* ---------- Pager ---------- */
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}
.pager-bar .pagination .page-link {
  color: #333;
  border-color: var(--border);
}
.pager-bar .pagination .page-item.active .page-link {
  background: var(--teal);
  border-color: var(--teal);
}
.pager-bar .pagination .page-item.disabled .page-link { color: #b7bcd0; }

.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar-row .page-size-col { min-width: 150px; }

/* ---------- Select2 (Bootstrap 5 theme touch-ups) ---------- */
.select2-container--bootstrap-5 .select2-selection {
  border-color: #ced4da;
  min-height: 38px;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--teal);
  box-shadow: 0 0 0 .2rem rgba(14,165,160,.15);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
  background-color: var(--teal) !important;
}
.select2-container--bootstrap-5 .select2-selection__choice {
  background-color: var(--teal) !important;
  border-color: var(--teal-dark) !important;
}

/* ---------- Flatpickr ---------- */
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--teal);
  border-color: var(--teal);
}
.flatpickr-day.today { border-color: var(--teal); }
.flatpickr-months .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays { background: var(--navy); }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year,
span.flatpickr-weekday { color: #fff !important; background: transparent; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { fill: #fff; color: #fff; }

/* ---------- Custom checkboxes ---------- */
.form-check-input { width: 1.1em; height: 1.1em; margin-top: .2em; cursor: pointer; }
.form-check-input:checked {
  background-color: var(--teal);
  border-color: var(--teal);
}
.form-check-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 .2rem rgba(14,165,160,.15);
}
.form-check-label { cursor: pointer; }
.form-check-inline {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px 6px 10px;
  margin-right: 8px !important;
}

/* ---------- Nurse registration form ---------- */
.form-card .nav-tabs {
  border-bottom: 1px solid var(--border);
}
.form-card .nav-tabs .nav-link {
  color: var(--text-muted);
  font-size: .86rem;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
}
.form-card .nav-tabs .nav-link.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
  background: transparent;
}
.form-card .nav-tabs .nav-link:hover:not(.active) { color: #1f2338; }

.photo-preview {
  width: 110px; height: 110px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  overflow: hidden;
  font-size: 2.4rem;
  color: #c3c9dc;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.document-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  height: 100%;
}
.document-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px;
  background: #e6f9f1;
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}
