/* =====================================================================
   Theme - modeled on the reference HRMIS look (macintelz-001-site1).
   The --brand-* names are kept so every existing rule below (navbar leftover,
   buttons, badges, card-header, login page) picks up the new palette for
   free just by changing these values - no need to touch each rule.
   ===================================================================== */
:root {
  --brand-navy:        #0b2119;   /* sidebar top of gradient / dark surfaces */
  --brand-navy-dark:   #081712;   /* sidebar bottom of gradient */
  --brand-gold:        #f4b740;   /* accent / active-state / primary CTA */
  --brand-gold-dark:   #d99a1f;
  --brand-black:       #18231f;   /* body text */
  --brand-green:       #174332;   /* primary buttons */
  --brand-green2:      #1f6448;   /* primary button hover, links */
  --brand-cream:       #f6f8f7;   /* subtle header/th tint */

  /* Direct reference tokens, for the new component rules below. */
  --muted:  #67746e;
  --line:   #e2e8e4;
  --bg:     #f4f7f5;
  --pale:   #e5f2eb;
  --goldp:  #fff3d6;
  --red:    #b73535;
  --redp:   #fae8e6;
  --blue:   #2d6f9e;
  --bluep:  #e7f2f8;
}

body { background: var(--bg); color: var(--brand-black); font-family: Inter, "Segoe UI", Arial, sans-serif; }

/* ---- Navbar ---- */
.navbar.bg-dark {
  background-color: var(--brand-navy) !important;
  border-bottom: 3px solid var(--brand-gold);
}
.navbar.bg-dark .nav-link,
.navbar.bg-dark .navbar-text { color: rgba(255,255,255,.92); }
.navbar.bg-dark .nav-link:hover { color: var(--brand-gold); }
.navbar.bg-dark .dropdown-menu { border-top: 2px solid var(--brand-gold); }
.navbar-brand { color: #fff !important; }

/* ---- Primary buttons / links ---- */
.btn {
  border-radius: .55rem;
  font-weight: 700;
  font-size: .85rem;
  padding: .5rem 1rem;
}
.btn-sm { border-radius: .5rem; }
.btn-primary {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
  font-weight: 700;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--brand-green2) !important;
  border-color: var(--brand-green2) !important;
  color: #fff !important;
}
.btn-outline-primary {
  color: var(--brand-green2);
  border-color: var(--line);
}
.btn-outline-primary:hover {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
}
.btn-outline-secondary { border-color: var(--line); color: var(--muted); }
.btn-outline-secondary:hover { background-color: var(--brand-black); border-color: var(--brand-black); color: #fff; }
a { color: var(--brand-green2); }
a:hover { color: var(--brand-gold-dark); }

/* ---- Badges: soft "pill" pairs instead of Bootstrap's solid colors,
   matching the reference site's status pill treatment. Covers every
   badge_for_status()/role_label() badge across the app automatically. ---- */
.badge {
  border-radius: 999px;
  font-weight: 700;
  font-size: .66rem;
  letter-spacing: .01em;
  padding: .38em .7em;
}
.badge.bg-success  { background-color: var(--pale)  !important; color: #226d50 !important; }
.badge.bg-warning  { background-color: var(--goldp) !important; color: #865f0f !important; }
.badge.bg-info     { background-color: var(--bluep) !important; color: var(--blue) !important; }
.badge.bg-danger   { background-color: var(--redp)  !important; color: var(--red) !important; }
.badge.bg-primary  { background-color: var(--pale)  !important; color: var(--brand-green2) !important; }
.badge.bg-secondary{ background-color: #eef1ef !important; color: var(--muted) !important; }
.badge.bg-dark     { background-color: var(--brand-navy) !important; color: #fff !important; }

/* ---- Cards ---- */
.card {
  border: 1px solid var(--line);
  border-radius: .85rem;
  box-shadow: 0 7px 25px rgba(28, 58, 46, 0.04);
}
.card-header {
  background-color: var(--brand-cream);
  border-bottom: 1px solid var(--line);
  border-top-left-radius: .85rem !important;
  border-top-right-radius: .85rem !important;
  font-weight: 700;
  font-size: .9rem;
  color: var(--brand-black);
}

/* ---- Tables: uppercase muted header, quiet row dividers, no heavy
   Bootstrap borders - matches the reference's .table-card look. ---- */
main table {
  --bs-table-bg: transparent;
}
main thead th {
  background: var(--brand-cream);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
main tbody td {
  border-top: 1px solid #edf0ee;
  color: #4f5b56;
  font-size: .84rem;
  vertical-align: middle;
}
main .table > :not(caption) > * > * { padding: .65rem .85rem; }

/* ---- Forms ---- */
.form-control, .form-select {
  border: 1px solid var(--line);
  border-radius: .5rem;
  font-size: .85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-green2);
  box-shadow: 0 0 0 .2rem rgba(31, 100, 72, .12);
}
.form-label { font-size: .75rem; font-weight: 700; color: #56635d; }

/* ---- Alerts (flash messages) - softer, bordered, like the reference's
   .notice component instead of Bootstrap's saturated defaults. ---- */
.alert { border: 1px solid var(--line); border-radius: .65rem; font-size: .85rem; }
.alert-success { background: #edf7f2; border-color: #c8ddd2; color: var(--brand-green2); }
.alert-danger  { background: var(--redp); border-color: #e7bbb6; color: #9c3131; }
.alert-warning { background: var(--goldp); border-color: #f0dba3; color: #865f0f; }
.alert-info    { background: var(--bluep); border-color: #bcdcee; color: var(--blue); }

/* ---- Page content width: match the reference's centered, generously
   padded content column instead of edge-to-edge fluid. ---- */
main.container-fluid { max-width: 1500px; margin: 0 auto; padding-left: 2rem; padding-right: 2rem; }
@media (max-width: 575.98px) { main.container-fluid { padding-left: 1rem; padding-right: 1rem; } }

/* ---- Profile hero card (my_profile.php) - the reference site's green
   gradient banner used to introduce a self-service page. ---- */
.profile-hero {
  position: relative;
  overflow: hidden;
  padding: 2rem 2.25rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green2) 100%);
  color: #fff;
}
.profile-hero::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.profile-hero-kicker { display: block; margin-bottom: .35rem; color: var(--brand-gold); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.profile-hero h1 { margin: 0 0 .5rem; font-weight: 800; }
.profile-hero p { max-width: 42rem; margin: 0 0 1.1rem; color: rgba(255,255,255,.82); font-size: .88rem; }
.profile-hero .btn-light { font-weight: 700; }

/* ---- Navy "workflow" hero variant - same shape as .profile-hero, used for
   admin/monitoring pages (Attendance, Attendance Corrections) instead of
   the green self-service one, matching the reference site's own
   green-for-self-service vs navy-for-workflow convention. ---- */
.page-hero {
  position: relative;
  overflow: hidden;
  padding: 1.75rem 2.25rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-dark) 100%);
  color: #fff;
}
.page-hero::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.page-hero-kicker { display: block; margin-bottom: .35rem; color: var(--brand-gold); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.page-hero h1 { margin: 0 0 .4rem; font-weight: 800; font-size: 1.7rem; }
.page-hero p { max-width: 42rem; margin: 0; color: rgba(255,255,255,.78); font-size: .85rem; }

/* ---- Step indicator row (Attendance Corrections' 4-step "how this
   works" strip). ---- */
.step-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.step-row .step {
  flex: 1 1 200px;
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: #fff;
}
.step-row .step .num {
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: 50%;
  background: var(--pale);
  color: var(--brand-green2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem;
}
.step-row .step strong { display: block; font-size: .82rem; }
.step-row .step small { display: block; color: var(--muted); font-size: .7rem; margin-top: 2px; }

.profile-tile-avatar {
  width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: .65rem;
  background: var(--pale);
  color: var(--brand-green2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
}

/* ---- Login page ---- */
.brand-login-bg {
  background: linear-gradient(160deg, var(--brand-navy) 0%, var(--brand-navy-dark) 60%, var(--brand-black) 100%);
}
.brand-login-card { border-top: 5px solid var(--brand-gold); }

/* =====================================================================
   Sidebar navigation (replaces the old top navbar+dropdowns). Same brand
   colors as the rest of the app (navy body, gold accent for the active
   item / hover states), just laid out as a persistent left rail instead
   of a bar across the top.
   ===================================================================== */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
  width: 258px;
  flex: 0 0 258px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-navy-dark) 100%);
  color: #fff;
  border-right: 3px solid var(--brand-gold);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.14);
  color: #fff;
  text-decoration: none;
  flex: 0 0 auto;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand img { height: 34px; width: 34px; object-fit: contain; flex: 0 0 auto; }
.sidebar-brand i { font-size: 1.4rem; color: var(--brand-gold); flex: 0 0 auto; }
.sidebar-brand .brand-name { font-weight: 700; font-size: .92rem; line-height: 1.2; }

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .75rem .6rem;
}
.sidebar-nav a.side-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .65rem;
  margin: .12rem 0;
  border-radius: .5rem;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
}
.sidebar-nav a.side-link i { width: 1.1rem; text-align: center; color: rgba(255,255,255,.5); font-size: .98rem; flex: 0 0 auto; }
.sidebar-nav a.side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.side-link.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 var(--brand-gold); }
.sidebar-nav a.side-link.active i { color: var(--brand-gold); }

.sidebar-nav details { margin: .12rem 0; }
.sidebar-nav details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem .65rem;
  border-radius: .5rem;
  color: rgba(255,255,255,.82);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.sidebar-nav details > summary::-webkit-details-marker { display: none; }
.sidebar-nav details > summary i:first-child { width: 1.1rem; text-align: center; color: rgba(255,255,255,.5); font-size: .98rem; }
.sidebar-nav details > summary:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav details[open] > summary { color: #fff; }
.sidebar-nav details > summary .chevron { font-size: .7rem; color: rgba(255,255,255,.45); transition: transform .15s ease; }
.sidebar-nav details[open] > summary .chevron { transform: rotate(90deg); }
.sidebar-nav details a.side-link { margin-left: .35rem; font-size: .82rem; }
.sidebar-divider { height: 1px; margin: .5rem .65rem; background: rgba(255,255,255,.14); }

.sidebar-foot { flex: 0 0 auto; padding: .85rem .9rem; }

/* "Protected workspace" status badge - matches the reference sidebar's
   bottom-of-rail system status indicator (pulsing dot + note), replacing
   what used to be the user card here (the user's identity now lives in
   the topbar profile chip instead - see below). */
.sidebar-secure {
  margin: 0;
  padding: .8rem .85rem;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: .65rem;
  background: rgba(255,255,255,.04);
}
.sidebar-secure .dot {
  width: 8px; height: 8px; margin-top: 5px; flex: 0 0 auto;
  border-radius: 50%;
  background: #48c489;
  box-shadow: 0 0 0 4px rgba(72,196,137,.12);
}
.sidebar-secure strong, .sidebar-secure small { display: block; }
.sidebar-secure strong { font-size: .72rem; color: #fff; }
.sidebar-secure small { margin-top: 3px; color: rgba(255,255,255,.5); font-size: .64rem; }

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---- Topbar: persistent on every screen size (not just mobile).
   Left = mobile menu button + brand kicker; right = notification bell
   and a profile chip that opens a small dropdown (Change Password /
   Logout), matching the reference site's topbar composition. ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-kicker { color: var(--brand-green2); font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-toggle-btn { flex: 0 0 auto; }
.sidebar-backdrop { display: none; }

.topbar-bell {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  flex: 0 0 auto;
}
.topbar-bell:hover { color: var(--brand-green2); border-color: var(--brand-green2); }
.topbar-bell .badge { position: absolute; top: -6px; right: -6px; font-size: .6rem; padding: .3em .5em; }

.topbar-profile { position: relative; flex: 0 0 auto; }
.topbar-profile > button {
  display: flex; align-items: center; gap: .55rem;
  padding: .3rem .7rem .3rem .3rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: #fff;
  cursor: pointer;
}
.topbar-profile .avatar {
  width: 32px; height: 32px; flex: 0 0 auto;
  border-radius: .55rem;
  background: var(--pale);
  color: var(--brand-green2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem;
}
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.topbar-profile .who { text-align: left; line-height: 1.2; }
.topbar-profile .who strong { display: block; font-size: .78rem; color: var(--brand-black); }
.topbar-profile .who small { display: block; color: var(--muted); font-size: .64rem; }
.topbar-profile .dropdown-menu { min-width: 12rem; border: 1px solid var(--line); border-radius: .65rem; box-shadow: 0 12px 28px rgba(0,0,0,.1); }

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 1045;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 28px rgba(0,0,0,.25); }
  .sidebar-backdrop.show {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1040;
  }
}
