/* Hostel Manager theme - Bootstrap 5 overrides.
   Palette contrast (WCAG AA): primary #0b5d66 on white = 7.6:1; sidebar text #e6f1f3 on #12313a = 11.5:1. */
:root {
  --hm-primary: #0b5d66;
  --hm-primary-dark: #084650;
  --hm-sidebar-bg: #12313a;
  --hm-sidebar-text: #e6f1f3;
  --hm-sidebar-muted: #9fc0c7;
  --hm-surface: #f3f6f7;
  --hm-sidebar-width: 17rem;

  --bs-primary: var(--hm-primary);
  --bs-primary-rgb: 11, 93, 102;
  --bs-link-color: var(--hm-primary);
  --bs-link-color-rgb: 11, 93, 102;
  --bs-link-hover-color: var(--hm-primary-dark);
  --bs-body-bg: var(--hm-surface);
  --bs-focus-ring-color: rgba(11, 93, 102, .35);
}

.btn-primary {
  --bs-btn-bg: var(--hm-primary);
  --bs-btn-border-color: var(--hm-primary);
  --bs-btn-hover-bg: var(--hm-primary-dark);
  --bs-btn-hover-border-color: var(--hm-primary-dark);
  --bs-btn-active-bg: var(--hm-primary-dark);
  --bs-btn-active-border-color: var(--hm-primary-dark);
  --bs-btn-disabled-bg: var(--hm-primary);
  --bs-btn-disabled-border-color: var(--hm-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--hm-primary);
  --bs-btn-border-color: var(--hm-primary);
  --bs-btn-hover-bg: var(--hm-primary);
  --bs-btn-hover-border-color: var(--hm-primary);
  --bs-btn-active-bg: var(--hm-primary);
  --bs-btn-active-border-color: var(--hm-primary);
}
.form-check-input:checked { background-color: var(--hm-primary); border-color: var(--hm-primary); }
:focus-visible { outline: 3px solid #f5b301; outline-offset: 2px; }

.hm-skip { position: absolute; z-index: 2000; padding: .5rem 1rem; background: #fff; }

/* ---------- Shell ---------- */
.hm-shell { display: flex; min-height: 100vh; }
.hm-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.hm-content { flex: 1 0 auto; padding: 1.25rem; }
.hm-footer { padding: .75rem 1.25rem; font-size: .8125rem; color: #5c6b70; }

/* ---------- Sidebar ---------- */
.hm-sidebar { --bs-offcanvas-width: var(--hm-sidebar-width); --bs-offcanvas-bg: var(--hm-sidebar-bg); --bs-offcanvas-color: var(--hm-sidebar-text); }
.hm-sidebar-inner { background: var(--hm-sidebar-bg); color: var(--hm-sidebar-text); min-height: 100%; height: 100%; overflow-y: auto; padding-bottom: 1rem; }
@media (min-width: 992px) {
  .hm-sidebar { flex: 0 0 var(--hm-sidebar-width); width: var(--hm-sidebar-width); position: sticky; top: 0; height: 100vh; }
  .hm-sidebar-hidden .hm-sidebar { display: none; }
}
.hm-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; font-weight: 600; font-size: 1.15rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.hm-brand .bi { font-size: 1.4rem; color: #7fd3dc; }
.hm-nav { padding: .5rem .6rem; }
.hm-nav-group { margin-top: .35rem; }
.hm-nav-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0; padding: .65rem .75rem .45rem; border-radius: .4rem; color: var(--hm-sidebar-muted); cursor: pointer; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; user-select: none; }
.hm-nav-heading::-webkit-details-marker { display: none; }
.hm-nav-heading::marker { content: ''; }
.hm-nav-heading:hover { background: rgba(255,255,255,.07); color: #fff; }
.hm-nav-heading:focus-visible { outline-offset: -2px; }
.hm-nav-chevron { flex: 0 0 auto; font-size: .75rem; transition: transform .2s ease; }
.hm-nav-group[open] .hm-nav-chevron { transform: rotate(180deg); }
.hm-nav-items { padding: .1rem 0 .35rem; }
.hm-nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: .4rem; color: var(--hm-sidebar-text); text-decoration: none; }
.hm-nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.hm-nav-link.active { background: #fff; color: var(--hm-primary-dark); font-weight: 600; }
.hm-nav-link .bi { width: 1.25rem; text-align: center; }

/* ---------- Top bar ---------- */
.hm-topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; background: #fff; border-bottom: 1px solid #dde4e6; }
.hm-hostel-name { display: flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--hm-primary-dark); }
.hm-user-btn { display: flex; align-items: center; gap: .5rem; }
.hm-avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--hm-primary); color: #fff; font-size: .8rem; font-weight: 600; }

/* ---------- Content ---------- */
.hm-card { background: #fff; border: 1px solid #dde4e6; border-radius: .6rem; padding: 1.25rem; }
.table > :not(caption) > * > * { vertical-align: middle; }
.hm-table-wrap { background: #fff; border: 1px solid #dde4e6; border-radius: .6rem; overflow-x: auto; }
.hm-table-wrap .table { margin-bottom: 0; }
.hm-form { max-width: 46rem; }
.badge-active { background: #1b6e3c; }
.badge-inactive { background: #5c6b70; }
.hm-profile-form { max-width: 70rem; }
.hm-form-section { padding: 1.5rem; }
.hm-section-heading { display: flex; align-items: flex-start; gap: .85rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid #e5eaec; }
.hm-section-icon { display: inline-grid; flex: 0 0 auto; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .6rem; background: rgba(11, 93, 102, .1); color: var(--hm-primary); font-size: 1.15rem; }
.hm-audit-panel { background: #f8fafb; }
.hm-audit-panel dt { color: #5c6b70; font-weight: 600; }
.hm-form-actions { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 -.25rem; padding: 1rem 1.25rem; border: 1px solid #d8e1e3; border-radius: .6rem; background: rgba(255, 255, 255, .96); box-shadow: 0 -.35rem 1rem rgba(18, 49, 58, .08); backdrop-filter: blur(6px); }


/* ---------- Login ---------- */
.hm-login-body { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: linear-gradient(135deg, #12313a 0%, #0b5d66 100%); }
.hm-login-card { width: 100%; max-width: 26rem; background: #fff; border-radius: .8rem; padding: 2rem 1.75rem; box-shadow: 0 1rem 2.5rem rgba(0,0,0,.25); }
.hm-login-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; color: var(--hm-primary-dark); }
.hm-login-brand .bi { font-size: 1.8rem; }

@media (max-width: 575.98px) {
  .hm-content { padding: .9rem; }
  .hm-topbar { padding: .5rem .9rem; }
}

/* ---------- Residents ---------- */
.hm-resident-form { max-width: 80rem; }
.hm-form-nav { gap: .35rem; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; }
.hm-form-nav .nav-link { white-space: nowrap; color: var(--hm-primary-dark); background: #fff; border: 1px solid #d8e1e3; }
.hm-form-nav .nav-link.active { background: var(--hm-primary); border-color: var(--hm-primary); color: #fff; }
.hm-resident-form .tab-pane { min-height: 25rem; }
.hm-profile-photo { display: grid; place-items: center; flex: 0 0 auto; width: 4.5rem; height: 4.5rem; border-radius: 1rem; overflow: hidden; background: rgba(11, 93, 102, .12); color: var(--hm-primary); font-size: 2rem; }
.hm-profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.hm-metric { height: 100%; padding: 1rem; border: 1px solid #dde4e6; border-radius: .6rem; background: #fff; }
.hm-metric span { display: block; margin-bottom: .25rem; color: #5c6b70; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.hm-metric strong { color: #19343a; }
.hm-detail-tabs { gap: .15rem; border-bottom: 0; overflow-x: auto; flex-wrap: nowrap; }
.hm-detail-tabs .nav-link { white-space: nowrap; color: #40565c; border: 0; border-bottom: 3px solid transparent; }
.hm-detail-tabs .nav-link.active { color: var(--hm-primary); border-bottom-color: var(--hm-primary); background: transparent; font-weight: 600; }
.hm-detail-content { padding-top: 1rem; }
.hm-detail-list dt { color: #5c6b70; font-weight: 500; }
.hm-timeline { position: relative; padding-left: 1.25rem; border-left: 2px solid #d8e1e3; }
.hm-timeline-item { position: relative; padding: 0 0 1.25rem 1rem; }
.hm-timeline-item::before { position: absolute; left: -1.43rem; top: .3rem; width: .75rem; height: .75rem; border: 2px solid #fff; border-radius: 50%; background: var(--hm-primary); content: ''; }
.hm-timeline-item small { color: #687b80; }
.hm-status { background: #5c6b70; color: #fff; }
.hm-status-active, .hm-status-approved { background: #1b6e3c; }
.hm-status-applicant, .hm-status-awaitingcheckin, .hm-status-noticeperiod { background: #8a5a00; }
.hm-status-rejected, .hm-status-suspended, .hm-status-blacklisted { background: #a2272f; }
.hm-status-checkedout { background: #4b5960; }
.category-panel { display: none; }
.category-panel.is-active { display: block; }

/* Top bar notification bell */
.hm-bell { position: relative; display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: #19343a; text-decoration: none; font-size: 1.15rem; }
.hm-bell:hover { background: #eef3f4; }
.hm-bell-count { position: absolute; top: .1rem; right: .05rem; min-width: 1.1rem; padding: 0 .3rem; border-radius: 1rem; background: #c0392b; color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.1rem; text-align: center; }
