/* IPS - MIS (Academic) — shared styles
   Institute of Professional Studies, Gwalior */

:root {
  --ips-ink: #0d1b3f;
  --ips-ink-deep: #081227;
  --ips-ink-soft: #5b6472;
  --ips-accent: #d99a3d;
  --ips-accent-deep: #b87f2e;
  --ips-line: #dfe3ea;
  --ips-paper: #f6f7fa;
  --ips-font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --ips-font-body: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Horizontal-scroll safety net for wide content (e.g. the timetable grid) —
   deliberately set on ONE element only. Setting `overflow-x: auto` on both
   html AND body (as this used to) makes the browser force `overflow-y: auto`
   onto both of them too (per the CSS overflow spec, an element can't mix a
   non-visible x-overflow with a visible y-overflow), so html and body each
   become their own independently-scrollable box — two nested vertical
   scrollbars that drift out of sync as soon as a page is tall enough to
   scroll. Keeping it on `body` alone still shows a scrollbar instead of
   clipping wide content, without creating that second scroll container. */
body {
  background: var(--ips-paper);
  color: var(--ips-ink);
  font-family: var(--ips-font-body);
  overflow-x: auto;
}

h1, h2, h3,
.ips-page-head h1,
.ips-auth-title,
.ips-auth-hero-title,
.ips-sidebar-brand-name {
  font-family: var(--ips-font-display);
}

/* Compact, professional type scale for in-app headings — the browser
   default (h1 ~2.5rem) read as oversized for a dashboard/ERP context. */
.ips-page-head h1 { font-size: 1.45rem; }
.ips-panel h2 { font-size: 1.05rem; }

.ips-college-switcher select { min-width: 140px; }
.ips-user-pill { font-size: 0.85rem; }
.ips-role-badge {
  background: var(--ips-accent);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.75rem;
}

/* App shell — fixed-width left sidebar (desktop) that collapses into a
   Bootstrap offcanvas panel below the lg breakpoint, plus the flexible
   content column beside it. Unauthenticated pages (login) never render
   the shell, so they keep the plain centered layout below. */
.ips-app-shell { display: flex; align-items: stretch; min-height: 100vh; }

.ips-mobile-topbar {
  background: linear-gradient(180deg, var(--ips-ink) 0%, var(--ips-ink-deep) 100%);
  padding: 10px 16px;
}
.ips-mobile-topbar .navbar-brand { color: #fff; font-family: var(--ips-font-display); font-weight: 700; }
.ips-mobile-toggle { color: #fff; border-color: rgba(255,255,255,0.35); }

.ips-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ips-ink) 0%, var(--ips-ink-deep) 100%);
  color: #fff;
  transition: width 0.18s ease;
}
.ips-sidebar-body { display: flex; flex-direction: column; height: 100%; padding: 20px 14px; }

/* Desktop sidebar collapse — toggled from the topbar, state remembered in
   localStorage. Scoped to the lg breakpoint and up; below it the sidebar is
   already Bootstrap's offcanvas drawer and this class has no effect there. */
@media (min-width: 992px) {
  .ips-sb-collapsed .ips-sidebar { width: 0; min-width: 0; overflow: hidden; border: 0; }
  .ips-sb-collapsed .ips-sidebar-body { padding-left: 0; padding-right: 0; opacity: 0; pointer-events: none; }
}
.ips-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 16px;
}
.ips-sidebar-brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--ips-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em; flex-shrink: 0;
}
.ips-sidebar-brand-name { font-size: 1.02rem; font-weight: 700; line-height: 1.2; }
.ips-sidebar-brand-sub { font-size: 0.7rem; color: rgba(255,255,255,0.55); }

.ips-sidebar-nav { flex: 1 1 auto; overflow-y: auto; }
.ips-sidebar-nav .nav-link {
  color: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 2px;
  font-size: 0.9rem;
  font-weight: 500;
}
.ips-sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.ips-sidebar-nav .nav-link.active {
  background: var(--ips-accent);
  color: #1f1204;
  font-weight: 600;
}

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

/* Content topbar — white bar above every signed-in page: a desktop-only
   sidebar collapse toggle on the left, college switcher / user identity /
   logout on the right (logout deliberately lives here, not in the sidebar,
   so it's always reachable in the same top-right spot). */
.ips-topbar {
  background: #fff;
  border-bottom: 1px solid var(--ips-line);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ips-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ips-topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ips-sidebar-toggle {
  border: 1px solid var(--ips-line);
  background: #fff;
  color: var(--ips-ink);
  border-radius: 8px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.ips-sidebar-toggle:hover { background: var(--ips-paper); }
.ips-topbar-college { color: var(--ips-ink-soft); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ips-topbar-college strong { color: var(--ips-ink); }
.ips-topbar-college-switcher select { min-width: 0; font-size: 0.82rem; }
.ips-topbar-user { font-size: 0.82rem; color: var(--ips-ink-soft); white-space: nowrap; }
.ips-topbar-user strong { color: var(--ips-ink); font-weight: 600; }
.ips-topbar-user .ips-role-badge { margin-left: 4px; }
.ips-topbar-logout { font-size: 0.8rem; padding: 5px 14px; }

.ips-main { padding: 24px 16px 56px; max-width: 1100px; width: 100%; }
.ips-main-unauth { padding: 0; }

.ips-page-head { margin-bottom: 24px; }
.ips-page-head h1 { font-weight: 700; margin-bottom: 4px; }

.ips-stat-row { margin-bottom: 8px; }
.ips-stat-card {
  background: #fff;
  border: 1px solid var(--ips-line);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.ips-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--ips-accent-deep); line-height: 1; }
.ips-stat-label { color: var(--ips-ink-soft); font-size: 0.78rem; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

.ips-panel {
  background: #fff;
  border: 1px solid var(--ips-line);
  border-radius: 10px;
  padding: 22px;
}
.ips-panel h2 { margin-bottom: 14px; }

/* Equal-height side-by-side panels (two Bootstrap columns in one row, e.g. a
   list panel next to a form panel, or the two dashboard quick-panels) need
   `.ips-panel` to fill its column so both panels line up. But a `.ips-panel`
   that is NOT inside a grid column — e.g. the roster/calendar panels stacked
   full-width on the attendance pages — must size to its own content instead.
   `height: 100%` on the base .ips-panel (as this used to be) forced every
   panel to the height of the page's outer flex chain regardless of content,
   so tall panels (a full month calendar, a long roster) silently overflowed
   past their own box instead of growing it, which is what caused the extra
   scrolling and the misaligned-looking footer on the attendance pages.

   The `:only-child` check matters just as much as the column check: several
   pages (e.g. the timetable page's "Effective date" + "Add a slot" panels,
   or a quiz's list of question panels) stack MULTIPLE .ips-panel elements
   inside the SAME column. If every one of those got height:100% too, each
   would try to fill the whole column on its own and they'd pile up/overlap
   instead of stacking normally — which is the "one box comes under another
   instead of beside it" layout break. Equal-height stretch only makes sense
   when a column holds exactly one panel that should match its sibling
   column's height; a column with several stacked panels should just let
   them size to their own content and stack. */
[class*="col-"] > .ips-panel:only-child {
  height: 100%;
}

/* When a column stacks 2+ panels next to a taller sibling column (e.g. the
   timetable page's "Effective date" + "Add a slot" boxes next to the grid),
   letting every panel size to its own content (above) can leave the column
   shorter than its sibling — visually empty space below the last panel.
   Make that column a flex column and let only its LAST panel grow to fill
   the remaining height, so the two columns still end at the same line; the
   earlier panel(s) keep their natural height, they just don't leave a gap
   under them anymore. */
[class*="col-"]:has(> .ips-panel ~ .ips-panel) {
  display: flex;
  flex-direction: column;
}
[class*="col-"] > .ips-panel:last-child:not(:only-child) {
  flex: 1 1 auto;
}

.ips-table { font-size: 0.92rem; }
.ips-table thead th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ips-ink-soft);
  border-bottom-width: 1px;
}

.ips-role-admin     { background: var(--ips-ink); color: #fff; }
.ips-role-hod       { background: var(--ips-accent); color: #fff; }
.ips-role-faculty   { background: #2e7d53; color: #fff; }
.ips-role-student   { background: #6c7686; color: #fff; }
.ips-role-principal { background: #6a3f9e; color: #fff; }
.ips-role-dean      { background: #1f6f8b; color: #fff; }

.ips-roadmap-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ips-roadmap-list .badge { margin-right: 8px; }

.ips-def-list { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 8px; margin: 0; }
.ips-def-list dt { color: var(--ips-ink-soft); font-size: 0.85rem; }
.ips-def-list dd { margin: 0; font-weight: 600; }

.ips-recent-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--ips-line); }
.ips-recent-row:last-child { border-bottom: none; }

/* Login — split screen: navy brand/feature panel + white sign-in panel. */
.ips-auth-wrap { display: flex; min-height: 100vh; }
.ips-auth-hero {
  flex: 1 1 46%;
  background: linear-gradient(160deg, var(--ips-ink) 0%, var(--ips-ink-deep) 100%);
  color: #fff;
  padding: 40px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ips-auth-hero::before {
  content: "";
  position: absolute;
  width: 340px; height: 340px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06);
  right: -140px; bottom: -170px;
}
.ips-auth-hero::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06);
  right: -60px; bottom: -100px;
}
.ips-auth-hero-inner { position: relative; z-index: 1; max-width: 400px; }
.ips-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.ips-auth-brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--ips-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
}
.ips-auth-brand-name { font-weight: 700; font-size: 0.92rem; line-height: 1.25; }
.ips-auth-brand-sub { font-size: 0.68rem; color: rgba(255,255,255,0.6); }
.ips-auth-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(217,154,61,0.55);
  color: var(--ips-accent);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.ips-auth-hero-title {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
}
.ips-auth-hero-title .ips-accent-word { color: var(--ips-accent); }
.ips-auth-hero-text { color: rgba(255,255,255,0.72); font-size: 0.85rem; line-height: 1.55; margin-bottom: 24px; }
.ips-auth-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.ips-auth-features li { font-size: 0.78rem; color: rgba(255,255,255,0.85); display: flex; align-items: center; gap: 7px; }
.ips-auth-features li::before {
  content: "\2713";
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(217,154,61,0.18);
  color: var(--ips-accent);
  font-size: 0.6rem; font-weight: 700; flex-shrink: 0;
}

.ips-auth-panel {
  flex: 1 1 54%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.ips-auth-card { width: 100%; max-width: 360px; }
.ips-auth-title { font-size: 1.4rem; font-weight: 700; color: var(--ips-ink); margin-bottom: 4px; }
.ips-auth-subtitle { color: var(--ips-ink-soft); font-size: 0.9rem; margin-bottom: 28px; }
.ips-auth-card label.form-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ips-ink-soft);
}
.ips-auth-card .form-control {
  border-radius: 8px;
  padding: 10px 14px;
  border-color: var(--ips-line);
}
.ips-auth-card .form-control:focus {
  border-color: var(--ips-accent);
  box-shadow: 0 0 0 0.2rem rgba(217,154,61,0.18);
}
.ips-auth-card .btn-primary {
  border-radius: 8px;
  padding: 11px;
  font-weight: 600;
  background: var(--ips-ink);
  border-color: var(--ips-ink);
}
.ips-auth-card .btn-primary:hover { background: var(--ips-ink-deep); border-color: var(--ips-ink-deep); }
.ips-auth-hint { margin-top: 24px; font-size: 0.78rem; color: var(--ips-ink-soft); text-align: center; }

@media (max-width: 991.98px) {
  .ips-auth-wrap { flex-direction: column; }
  .ips-auth-hero { padding: 40px 28px; }
  .ips-auth-features { grid-template-columns: 1fr 1fr; }
}

.ips-footer {
  background: #fff;
  padding: 18px 16px;
  color: var(--ips-ink-soft);
  font-size: 0.8rem;
  border-top: 1px solid var(--ips-line);
}

.btn-primary {
  background-color: var(--ips-accent-deep);
  border-color: var(--ips-accent-deep);
}
.btn-primary:hover {
  background-color: var(--ips-accent);
  border-color: var(--ips-accent);
}
.btn-outline-primary {
  color: var(--ips-accent-deep);
  border-color: var(--ips-accent-deep);
}
.btn-outline-primary:hover {
  background-color: var(--ips-accent-deep);
  border-color: var(--ips-accent-deep);
}

.ips-dept-switcher { margin-bottom: 6px; }

/* Timetable grid — mirrors the institute's printed day x time-slot class time table */
.ips-timetable-heading {
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ips-ink);
}
.ips-timetable-heading-main { font-weight: 700; font-size: 1.05rem; color: var(--ips-ink); }
.ips-timetable-heading-sub { color: var(--ips-ink-soft); font-size: 0.88rem; margin-top: 2px; }
.ips-timetable-heading-wef { color: var(--ips-accent-deep); font-size: 0.8rem; margin-top: 4px; font-weight: 600; }

.ips-timetable-grid { font-size: 0.82rem; }
.ips-timetable-grid th, .ips-timetable-grid td {
  vertical-align: middle;
  text-align: center;
  border-color: var(--ips-line);
}
.ips-timetable-grid thead th {
  background: var(--ips-ink);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}
.ips-timetable-grid thead th small { display: block; font-weight: 400; opacity: 0.85; font-size: 0.68rem; }
.ips-timetable-corner { min-width: 92px; }
.ips-timetable-day { background: var(--ips-paper); font-weight: 700; white-space: nowrap; }
.ips-timetable-lunch-col { background: var(--ips-accent-deep); }
.ips-timetable-lunch-cell {
  background: repeating-linear-gradient(45deg, #f1ece2, #f1ece2 6px, #e8e0cf 6px, #e8e0cf 12px);
  color: var(--ips-ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  writing-mode: vertical-rl;
  min-width: 34px;
}
.ips-timetable-cell { min-width: 108px; position: relative; }
.ips-timetable-slot { position: relative; padding-right: 2px; }
.ips-timetable-subject { font-weight: 600; color: var(--ips-ink); }
.ips-timetable-faculty { font-weight: 400; color: var(--ips-ink-soft); }
.ips-timetable-dept { margin-top: 3px; display: inline-block; font-size: 0.62rem; }
.ips-timetable-room { color: var(--ips-ink-soft); font-size: 0.72rem; margin-top: 2px; }
.ips-timetable-remove { position: absolute; top: -8px; right: -6px; }
.ips-timetable-remove .btn { line-height: 1; font-size: 1rem; }

/* Attendance calendar view — used by student/faculty/HOD/admin attendance pages */
.ips-calendar-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.ips-calendar-toolbar-label { font-weight: 700; color: var(--ips-ink); min-width: 130px; text-align: center; }

.ips-calendar { border: 1px solid var(--ips-line); border-radius: 10px; overflow: hidden; background: #fff; }
.ips-calendar-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ips-calendar-headcell {
  background: var(--ips-ink);
  color: #fff;
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 4px;
  font-weight: 600;
}
.ips-calendar-cell {
  display: block;
  min-height: 64px;
  padding: 6px 7px;
  border: 1px solid var(--ips-line);
  border-width: 0 1px 1px 0;
  color: inherit;
  text-decoration: none;
  font-size: 0.78rem;
}
a.ips-calendar-cell:hover { background: var(--ips-paper); }
.ips-calendar-row .ips-calendar-cell:nth-child(7n) { border-right-width: 0; }
.ips-calendar-blank { background: #fbfbf9; }
.ips-calendar-daynum { font-weight: 700; font-size: 0.72rem; color: var(--ips-ink-soft); margin-bottom: 3px; }
.ips-calendar-cell.ips-cal-future { color: #b9bec6; background: #fcfcfb; }
.ips-calendar-cell.ips-cal-today .ips-calendar-daynum { color: #fff; background: var(--ips-accent-deep); border-radius: 999px; display: inline-block; min-width: 18px; padding: 0 5px; }
.ips-calendar-cell.ips-cal-selected { outline: 2px solid var(--ips-accent-deep); outline-offset: -2px; }

.ips-calendar-cell.ips-cal-present  { background: #e6f4ea; }
.ips-calendar-cell.ips-cal-absent   { background: #fbe9e9; }
.ips-calendar-cell.ips-cal-late     { background: #fff6df; }
.ips-calendar-cell.ips-cal-strong   { background: #e6f4ea; }
.ips-calendar-cell.ips-cal-weak     { background: #fbe9e9; }
.ips-calendar-cell.ips-cal-partial  { background: #fff6df; }
.ips-calendar-cell.ips-cal-unmarked { background: #fff; }
.ips-calendar-status { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.ips-calendar-count  { font-size: 0.72rem; color: var(--ips-ink-soft); }

.ips-calendar-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ips-ink-soft); margin-top: 12px; }
.ips-calendar-legend-item { display: flex; align-items: center; gap: 6px; }
.ips-calendar-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--ips-line); }

.ips-topic-box { border-left: 4px solid var(--ips-accent-deep); }
.ips-topic-recent { list-style: none; margin: 0; padding: 0; }
.ips-topic-recent li { padding: 6px 0; border-bottom: 1px solid var(--ips-line); font-size: 0.85rem; }
.ips-topic-recent li:last-child { border-bottom: none; }
.ips-topic-recent-date { font-weight: 700; color: var(--ips-ink-soft); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; display: block; }
