/* Iria Rwa Mbogo Academy School — shared light/dark theme
   Applied via [data-theme="dark"] on <html>. Default (no attribute) = light. */

:root{
  --IRMAS-bg:#f4f6f9;
  --IRMAS-surface:#ffffff;
  --IRMAS-surface-2:#f8f9fb;
  --IRMAS-text:#1c2333;
  --IRMAS-text-muted:#6c757d;
  --IRMAS-border:#e5e7eb;
  --IRMAS-sidebar-bg:#0b3d91;
  --IRMAS-sidebar-text:#dbe4ff;
  --IRMAS-sidebar-hover:#123b8a;
  --IRMAS-topbar-bg:#ffffff;
  --IRMAS-shadow:0 1px 3px rgba(0,0,0,.06);
  --IRMAS-input-bg:#ffffff;
  --IRMAS-input-text:#1c2333;
  --IRMAS-auth-grad-1:#0b3d91;
  --IRMAS-auth-grad-2:#123b8a;
  --IRMAS-gold:#c9974a;
  --IRMAS-gold-bright:#e9c583;
}

html[data-theme="dark"]{
  --IRMAS-bg:#0f1420;
  --IRMAS-surface:#171d2c;
  --IRMAS-surface-2:#1d2436;
  --IRMAS-text:#e7eaf3;
  --IRMAS-text-muted:#9aa3b8;
  --IRMAS-border:#2a3245;
  --IRMAS-sidebar-bg:#081026;
  --IRMAS-sidebar-text:#c7d2fe;
  --IRMAS-sidebar-hover:#141f3d;
  --IRMAS-topbar-bg:#171d2c;
  --IRMAS-shadow:0 1px 3px rgba(0,0,0,.4);
  --IRMAS-input-bg:#1d2436;
  --IRMAS-input-text:#e7eaf3;
  --IRMAS-auth-grad-1:#050a17;
  --IRMAS-auth-grad-2:#0b3d91;
  --IRMAS-gold:#c9974a;
  --IRMAS-gold-bright:#f0cd8f;

  /* Bootstrap 5 components (dropdown, nav-tabs, alert, list-group, modal,
     badges, etc.) read their own separate --bs-* variables rather than our
     --IRMAS-* ones - without this, those components silently kept their
     light-mode dark text sitting on a dark background and became
     unreadable. This maps the ones we actually use onto the dark palette. */
  --bs-body-color: var(--IRMAS-text);
  --bs-body-bg: var(--IRMAS-bg);
  --bs-border-color: var(--IRMAS-border);
  --bs-secondary-color: var(--IRMAS-text-muted);
  --bs-tertiary-bg: var(--IRMAS-surface-2);
  --bs-emphasis-color: var(--IRMAS-text);
  --bs-heading-color: var(--IRMAS-text);

  --bs-dropdown-bg: var(--IRMAS-surface);
  --bs-dropdown-color: var(--IRMAS-text);
  --bs-dropdown-link-color: var(--IRMAS-text);
  --bs-dropdown-link-hover-color: var(--IRMAS-text);
  --bs-dropdown-link-hover-bg: var(--IRMAS-border);
  --bs-dropdown-border-color: var(--IRMAS-border);
  --bs-dropdown-divider-bg: var(--IRMAS-border);
  --bs-dropdown-header-color: var(--IRMAS-text-muted);

  --bs-nav-link-color: var(--IRMAS-text-muted);
  --bs-nav-link-hover-color: var(--IRMAS-text);
  --bs-nav-tabs-link-active-color: var(--IRMAS-text);
  --bs-nav-tabs-link-active-bg: var(--IRMAS-surface);
  --bs-nav-tabs-border-color: var(--IRMAS-border);
  --bs-nav-tabs-link-hover-border-color: var(--IRMAS-border);

  --bs-alert-bg: var(--IRMAS-surface-2);
  --bs-alert-color: var(--IRMAS-text);
  --bs-alert-border-color: var(--IRMAS-border);

  --bs-list-group-color: var(--IRMAS-text);
  --bs-list-group-bg: var(--IRMAS-surface);
  --bs-list-group-border-color: var(--IRMAS-border);
  --bs-list-group-action-color: var(--IRMAS-text);
  --bs-list-group-action-hover-color: var(--IRMAS-text);
  --bs-list-group-action-hover-bg: var(--IRMAS-border);

  --bs-modal-bg: var(--IRMAS-surface);
  --bs-modal-color: var(--IRMAS-text);
  --bs-modal-header-border-color: var(--IRMAS-border);
  --bs-modal-footer-border-color: var(--IRMAS-border);

  --bs-card-bg: var(--IRMAS-surface);
  --bs-card-color: var(--IRMAS-text);
  --bs-card-border-color: var(--IRMAS-border);

  --bs-table-color: var(--IRMAS-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--IRMAS-border);

  color-scheme: dark;
}

html, body{ background:var(--IRMAS-bg); color:var(--IRMAS-text); }
body{ transition:background-color .2s ease, color .2s ease; }

.card{ background:var(--IRMAS-surface); color:var(--IRMAS-text); box-shadow:var(--IRMAS-shadow); }
.topbar{ background:var(--IRMAS-topbar-bg); border-bottom:1px solid var(--IRMAS-border); }
.sidebar{ background:var(--IRMAS-sidebar-bg); }
.sidebar a{ color:var(--IRMAS-sidebar-text); }
.sidebar a:hover, .sidebar a.active{ background:var(--IRMAS-sidebar-hover); color:#fff; }

.table{ color:var(--IRMAS-text); }
html[data-theme="dark"] .table{ --bs-table-bg:transparent; }
html[data-theme="dark"] .table-light, html[data-theme="dark"] thead.table-light{ --bs-table-bg:#1d2436; --bs-table-color:#e7eaf3; }
html[data-theme="dark"] .modal-content{ background:var(--IRMAS-surface); color:var(--IRMAS-text); }
html[data-theme="dark"] .text-muted{ color:var(--IRMAS-text-muted) !important; }
html[data-theme="dark"] hr{ border-color:var(--IRMAS-border); }

.form-control, .form-select{
  background-color:var(--IRMAS-input-bg);
  color:var(--IRMAS-input-text);
  border-color:var(--IRMAS-border);
}
.form-control:focus, .form-select:focus{
  background-color:var(--IRMAS-input-bg);
  color:var(--IRMAS-input-text);
}
html[data-theme="dark"] .form-control::placeholder{ color:#7c86a0; }
html[data-theme="dark"] .form-control:disabled, html[data-theme="dark"] .form-select:disabled{ background-color:#151b2a; }

/* password show/hide toggle, injected by site.js */
.IRMAS-pw-wrap{ position:relative; display:flex; width:100%; }
.IRMAS-pw-wrap .form-control{ padding-right:2.6rem; flex:1 1 auto; width:100%; }
.IRMAS-pw-toggle{
  position:absolute; right:.4rem; top:50%; transform:translateY(-50%);
  border:none; background:transparent; color:var(--IRMAS-text-muted);
  width:2rem; height:2rem; display:flex; align-items:center; justify-content:center;
  border-radius:50%; cursor:pointer;
}
.IRMAS-pw-toggle:hover{ color:var(--IRMAS-text); background:rgba(127,127,127,.15); }

/* theme toggle switch */
.IRMAS-theme-toggle{
  border:1px solid var(--IRMAS-border); background:var(--IRMAS-surface-2); color:var(--IRMAS-text);
  border-radius:999px; width:2.2rem; height:2.2rem; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.IRMAS-theme-toggle:hover{ background:var(--IRMAS-border); }

/* generic topbar icon button (notifications bell, etc.) - same look as the
   theme toggle but NOT matched by site.js's .IRMAS-theme-toggle selector,
   so it doesn't get its icon overwritten or a theme-toggle click handler. */
.IRMAS-icon-btn{
  border:1px solid var(--IRMAS-border); background:var(--IRMAS-surface-2); color:var(--IRMAS-text);
  border-radius:999px; width:2.2rem; height:2.2rem; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.IRMAS-icon-btn:hover{ background:var(--IRMAS-border); }

/* auth pages (login/reset/change password) gradient background, theme-aware */
.IRMAS-auth-bg{
  background:linear-gradient(135deg,var(--IRMAS-auth-grad-1),var(--IRMAS-auth-grad-2));
  min-height:100vh; display:flex; align-items:center;
}
.IRMAS-auth-topright{ position:fixed; top:.75rem; right:.75rem; z-index:10; display:flex; align-items:center; gap:.6rem; }

/* ---------- Sidebar navigation: grouped, collapsible, gold-on-navy "sexy" ---------- */
.sidebar{
  display:flex; flex-direction:column;
  position:relative;
  background:
    radial-gradient(720px 360px at -8% -12%, rgba(233,197,131,.16), transparent 60%),
    linear-gradient(172deg, var(--IRMAS-sidebar-bg) 0%, var(--IRMAS-auth-grad-2) 58%, var(--IRMAS-sidebar-bg) 128%);
  box-shadow:6px 0 28px rgba(0,0,0,.22);
  overflow:hidden;
  transition:width .25s ease, min-width .25s ease, opacity .2s ease, box-shadow .25s ease;
}

/* Hide/show toggle (topbar button, state kept in localStorage - see site.js).
   Collapses the sidebar to 0 width instead of unmounting it, so the slide
   animates smoothly and nothing inside needs to be re-rendered when it's
   shown again. */
html[data-sidebar="hidden"] .sidebar{
  width:0 !important; min-width:0 !important; opacity:0; box-shadow:none; pointer-events:none;
}
.IRMAS-sidebar-toggle.active{ background:var(--IRMAS-gold-bright); color:#1a1a1a; border-color:var(--IRMAS-gold-bright); }
.sidebar::after{
  content:""; position:absolute; top:0; right:0; bottom:0; width:1px;
  background:linear-gradient(180deg, transparent, rgba(233,197,131,.4) 18%, rgba(233,197,131,.4) 82%, transparent);
  pointer-events:none;
}

/* brand block */
.sidebar .brand{
  flex:0 0 auto;
  display:flex; align-items:center; gap:.75rem;
  padding:1.15rem 1.15rem 1rem;
  border-bottom:1px solid rgba(255,255,255,.09);
}
.sidebar .brand-badge{
  width:42px; height:42px; flex:0 0 auto; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(155deg, rgba(255,255,255,.18), rgba(255,255,255,.02));
  border:1px solid rgba(233,197,131,.5);
  box-shadow:0 0 0 4px rgba(233,197,131,.09), 0 8px 18px rgba(0,0,0,.28);
}
.sidebar .brand-badge img{ width:26px; height:26px; object-fit:contain; filter:drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.sidebar .brand-text{ min-width:0; line-height:1.15; }
.sidebar .brand-name{
  display:block; font-family:'Fraunces','Georgia',serif; font-weight:600; font-size:1.04rem;
  color:#fff; letter-spacing:.01em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sidebar .brand-tag{
  display:block; margin-top:.15rem; font-size:.62rem; font-weight:700;
  letter-spacing:.15em; text-transform:uppercase; color:var(--IRMAS-gold-bright); opacity:.9;
}
.sidebar .brand-branch{
  display:block; margin-top:.1rem; font-size:.78rem; font-weight:600;
  color:#fff; opacity:.92; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.sidebar-scroll{
  flex:1 1 auto; overflow-y:auto; overflow-x:hidden;
  padding:.6rem 0; padding-right:2px;
}
.sidebar-scroll::-webkit-scrollbar{ width:6px; }
.sidebar-scroll::-webkit-scrollbar-thumb{ background:rgba(233,197,131,.28); border-radius:999px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover{ background:rgba(233,197,131,.45); }
.sidebar-scroll::-webkit-scrollbar-track{ background:transparent; }

.nav-link-item{
  position:relative;
  display:flex !important; align-items:center; gap:.7rem;
  padding:.45rem .75rem !important;
  margin:.1rem .55rem; border-radius:.65rem;
  font-size:.865rem; font-weight:500;
  color:var(--IRMAS-sidebar-text);
  transition:background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nav-link-item .nav-ico{
  flex:0 0 auto; width:1.75rem; height:1.75rem; border-radius:.5rem;
  display:flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.05); color:inherit; font-size:.92rem;
  transition:background .18s ease, color .18s ease, box-shadow .18s ease;
}
.nav-link-item span{ flex:1 1 auto; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-link-item:hover{ background:rgba(255,255,255,.075); color:#fff; transform:translateX(3px); }
.nav-link-item:hover .nav-ico{ background:rgba(255,255,255,.12); }
.nav-link-item.active{
  background:linear-gradient(90deg, rgba(233,197,131,.2), rgba(233,197,131,.04) 85%);
  color:#fff; font-weight:600;
  box-shadow:inset 0 0 0 1px rgba(233,197,131,.2);
}
.nav-link-item.active .nav-ico{
  background:linear-gradient(155deg, var(--IRMAS-gold-bright), var(--IRMAS-gold));
  color:#231703;
  box-shadow:0 2px 12px rgba(233,197,131,.5);
}
.nav-link-item.active::before{
  content:""; position:absolute; left:-.15rem; top:.28rem; bottom:.28rem; width:3px;
  border-radius:999px; background:linear-gradient(180deg, var(--IRMAS-gold-bright), var(--IRMAS-gold));
  box-shadow:0 0 9px rgba(233,197,131,.75);
}
.nav-badge{
  background:#e63946; color:#fff; border-radius:999px;
  font-size:.68rem; font-weight:700; padding:.1rem .42rem; line-height:1.35;
  flex:0 0 auto; box-shadow:0 0 0 1px rgba(255,255,255,.12);
}

.nav-group{ margin:.2rem 0; }
.nav-group-toggle{
  display:flex; align-items:center; gap:.65rem; width:100%;
  padding:.5rem .75rem; margin:.1rem .55rem; border-radius:.6rem;
  border:none; background:transparent; text-align:left;
  font-size:.74rem; font-weight:700; letter-spacing:.07em; text-transform:uppercase;
  color:rgba(255,255,255,.6);
  transition:background-color .15s ease, color .15s ease;
}
.nav-group-toggle .nav-group-ico{
  flex:0 0 auto; width:1.4rem; height:1.4rem; border-radius:.4rem;
  display:flex; align-items:center; justify-content:center; font-size:.82rem;
  background:rgba(255,255,255,.04);
}
.nav-group-toggle span{ flex:1 1 auto; }
.nav-group-toggle:hover{ background:rgba(255,255,255,.06); color:#fff; }
.nav-group-toggle:hover .nav-group-ico{ background:rgba(233,197,131,.16); color:var(--IRMAS-gold-bright); }
.nav-group-chevron{ font-size:.72rem !important; width:auto !important; transition:transform .2s ease; opacity:.7; }
.nav-group-toggle.collapsed .nav-group-chevron{ transform:rotate(-90deg); }
.nav-group .nav-link-item{ padding-left:.75rem !important; margin-left:1.35rem; font-size:.83rem; }
.nav-group .nav-link-item .nav-ico{ width:1.55rem; height:1.55rem; font-size:.82rem; }

/* footer: signed-in user card + quick actions */
.sidebar-foot{
  flex:0 0 auto; padding:.7rem .75rem .9rem;
  border-top:1px solid rgba(255,255,255,.09);
}
.sidebar-user{
  display:flex; align-items:center; gap:.6rem;
  padding:.45rem .55rem; margin-bottom:.5rem; border-radius:.65rem;
  background:rgba(255,255,255,.045);
}
.sidebar-user-avatar{
  width:36px; height:36px; border-radius:50%; object-fit:cover; flex:0 0 auto;
  border:2px solid var(--IRMAS-gold);
  box-shadow:0 0 0 3px rgba(233,197,131,.16);
}
.sidebar-user-info{ min-width:0; line-height:1.2; }
.sidebar-user-name{
  font-size:.82rem; font-weight:600; color:#fff;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sidebar-user-role{
  font-size:.66rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  color:var(--IRMAS-gold-bright); opacity:.9;
}
.sidebar-foot-actions{ display:flex; gap:.4rem; }
.sidebar-foot-actions a{
  flex:1 1 0; display:flex; align-items:center; justify-content:center;
  height:2.15rem; border-radius:.55rem; text-decoration:none; font-size:.95rem;
  color:var(--IRMAS-sidebar-text); background:rgba(255,255,255,.045);
  transition:background .15s ease, color .15s ease, transform .15s ease;
}
.sidebar-foot-actions a:hover{ background:rgba(233,197,131,.18); color:#fff; transform:translateY(-1px); }
.sidebar-foot-actions a.sidebar-logout:hover{ background:rgba(230,57,70,.28); color:#ffc2c6; }

/* topbar status widget: clock / day / gps */
.IRMAS-status-widget{ font-size:.8rem; color:var(--IRMAS-text-muted); line-height:1.15; text-align:right; }
.IRMAS-status-widget .IRMAS-clock{ display:flex; align-items:center; justify-content:flex-end; gap:.45rem; }
.IRMAS-status-widget .IRMAS-clock-text{ font-weight:600; color:var(--IRMAS-text); font-variant-numeric:tabular-nums; }
.IRMAS-status-widget .IRMAS-gps{ display:flex; align-items:center; gap:.25rem; justify-content:flex-end; }
.IRMAS-status-widget .IRMAS-gps a{ color:inherit; text-decoration:underline dotted; }

/* Analog clock face - mirrors the classic 12-number watch design, scaled down
   for the topbar/login widget, and fully theme-aware (light/dark via the
   --IRMAS-* variables already used across the app). */
.IRMAS-clock-face{
  position:relative; flex:0 0 auto;
  width:30px; height:30px; border-radius:50%;
  background:var(--IRMAS-surface);
  border:1.5px solid var(--IRMAS-border);
  box-shadow:0 1px 3px rgba(0,0,0,.12), inset 0 1px 2px rgba(0,0,0,.06);
}
.IRMAS-clock-face::before{ /* 12 o'clock tick */
  content:""; position:absolute; top:2px; left:50%;
  width:2px; height:4px; margin-left:-1px; border-radius:1px;
  background:var(--IRMAS-text-muted);
}
.IRMAS-hand{
  position:absolute; left:50%; bottom:50%;
  transform-origin:50% 100%;
  border-radius:2px;
  background:var(--IRMAS-text);
}
.IRMAS-hand-hour{ width:2px; height:8px; margin-left:-1px; }
.IRMAS-hand-minute{ width:1.5px; height:11px; margin-left:-.75px; }
.IRMAS-hand-second{ width:1px; height:12px; margin-left:-.5px; background:var(--IRMAS-gold); }
.IRMAS-clock-dot{
  position:absolute; top:50%; left:50%; width:4px; height:4px;
  margin:-2px 0 0 -2px; border-radius:50%;
  background:var(--IRMAS-gold); box-shadow:0 0 0 1px var(--IRMAS-surface);
}

/* Slightly larger on the login screen, where the widget has room to breathe */
.IRMAS-auth-topright .IRMAS-clock-face{ width:36px; height:36px; }
.IRMAS-auth-topright .IRMAS-hand-hour{ height:10px; }
.IRMAS-auth-topright .IRMAS-hand-minute{ height:13px; }
.IRMAS-auth-topright .IRMAS-hand-second{ height:14px; }
