/* ==========================================================================
   Student No Due Form – UI theme
   Brand maroon + gold taken from the college logo; neutral greys for chrome.
   ========================================================================== */
:root {
  --brand: #7a1f1f;
  --brand-dark: #561414;
  --brand-darker: #3f0e0e;
  --brand-soft: #f7ecec;
  --accent: #d4a017;

  --page: #f4f5f7;
  --surface: #ffffff;
  --border: #e5e7eb;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;

  /* Data-viz roles (reference palette) */
  --viz-series-1: #2a78d6;
  --viz-track: #cde2fb;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-muted: #898781;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --status-neutral: #a8a69e;

  --sidebar-w: 248px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--page); color: var(--ink); min-height: 100vh; font-size: .935rem; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
.text-brand { color: var(--brand) !important; }

/* ---------- Buttons / cards / tables ---------- */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-header:first-child { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; padding: .8rem 1rem; }
.card-header.brand { background: var(--surface); color: var(--ink); border-left: 4px solid var(--brand); }
.card-title-sm { font-size: .95rem; font-weight: 600; margin: 0; }
.card-sub { font-size: .8rem; color: var(--ink-3); font-weight: 400; }

.table { --bs-table-bg: transparent; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); font-weight: 600; background: #f9fafb; }
.table-responsive.bg-white { border: 1px solid var(--border); border-radius: var(--radius) !important; box-shadow: var(--shadow) !important; }
.num { font-variant-numeric: tabular-nums; }

.form-control, .form-select { border-color: #d1d5db; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(122, 31, 31, .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-pills .nav-link.active { background: var(--brand); }
.nav-pills .nav-link { color: var(--brand); }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 600; }
.page-link { color: var(--brand); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.required::after { content: " *"; color: #c00; }
.badge { font-weight: 600; }

/* ---------- Public / student top header ---------- */
.college-header { background: var(--surface); border-bottom: 3px solid var(--accent); }
.college-logo { height: 64px; width: 64px; object-fit: contain; }
.college-name { font-size: 1.35rem; font-weight: 700; color: var(--brand); line-height: 1.2; }
.college-sub { color: var(--ink-2); font-size: .9rem; }
.app-nav { background: var(--brand); }
.app-footer { color: var(--ink-3); }
@media (max-width: 576px) {
  .college-logo { height: 48px; width: 48px; }
  .college-name { font-size: 1rem; }
  .college-sub { font-size: .78rem; }
}

/* ---------- Staff/admin shell: sidebar + topbar ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand-dark), var(--brand-darker));
  color: #f3e7e7; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand-block { display: flex; gap: .7rem; align-items: center; padding: 1rem 1rem .9rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar .brand-block img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.sidebar .brand-block .t1 { font-weight: 700; font-size: .9rem; line-height: 1.15; color: #fff; }
.sidebar .brand-block .t2 { font-size: .72rem; color: #e9c9c9; }
.sidebar .nav-section { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #d9aaaa; padding: 1rem 1.1rem .35rem; }
.sidebar .nav-link {
  color: #f3e7e7; display: flex; align-items: center; gap: .65rem; padding: .5rem 1.1rem; margin: 1px .6rem;
  border-radius: 8px; font-size: .9rem;
}
.sidebar .nav-link i { font-size: 1.05rem; opacity: .9; width: 1.1rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--brand-dark); font-weight: 600; }
.sidebar .nav-link .count { margin-left: auto; background: var(--accent); color: #2b1d00; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; }
.sidebar .nav-link.active .count { background: var(--brand); color: #fff; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem 1.25rem;
  display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 1020;
}
.topbar .college { font-weight: 700; color: var(--brand); line-height: 1.15; }
.topbar .college small { display: block; font-weight: 400; color: var(--ink-3); font-size: .75rem; }
.exam-chip { background: var(--brand-soft); color: var(--brand); border: 1px solid #ecd5d5; border-radius: 999px; padding: .25rem .75rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.content { padding: 1.5rem 1.5rem 2rem; flex: 1; }
.content-footer { color: var(--ink-3); font-size: .8rem; padding: 0 1.5rem 1.25rem; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 1045; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .content { padding: 1rem; }
  .topbar .college-full { display: none; }
}
.sidebar-backdrop { display: none; }
.sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1040; }

/* ---------- Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--ink-3); font-size: .875rem; }

/* ---------- Stat tiles ---------- */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; height: 100%; display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.stat-tile:hover { border-color: #cbd5e1; transform: translateY(-1px); color: inherit; }
.stat-tile .label { font-size: .8rem; color: var(--ink-2); display: flex; align-items: center; gap: .45rem; }
.stat-tile .label i { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; }
.stat-tile .value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; margin-top: .55rem; color: var(--ink); }
.stat-tile .foot { font-size: .78rem; color: var(--ink-3); margin-top: .25rem; }
.ic-brand   { background: var(--brand-soft); color: var(--brand); }
.ic-blue    { background: #e7f0fb; color: #1c5cab; }
.ic-good    { background: #e3f5e3; color: #067306; }
.ic-warning { background: #fff4d6; color: #8a5a00; }
.ic-critical{ background: #fbe5e5; color: #a12a2a; }
.ic-neutral { background: #f0efec; color: #52514e; }

/* ---------- Charts ---------- */
.viz { position: relative; }
.viz-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .82rem; color: var(--ink-2); }
.viz-legend .key { display: inline-flex; align-items: center; gap: .4rem; }
.viz-legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-legend strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* stacked status bar: 2px surface gaps between segments, rounded ends */
.stackbar { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; background: var(--surface); }
.stackbar .seg { height: 100%; min-width: 3px; cursor: default; outline: none; }
.stackbar .seg:hover, .stackbar .seg:focus { filter: brightness(1.08); box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }

/* horizontal bars */
.hbars { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .55rem .75rem; align-items: center; }
.hbars .cat { font-size: .82rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbars .track { position: relative; height: 22px; border-left: 1px solid var(--viz-axis); }
.hbars .bar { height: 18px; margin-top: 2px; background: var(--viz-series-1); border-radius: 0 4px 4px 0; min-width: 2px; outline: none; }
.hbars .bar:hover, .hbars .bar:focus { filter: brightness(1.12); }
.hbars .val { position: absolute; top: 50%; transform: translateY(-50%); font-size: .78rem; color: var(--ink); font-weight: 600; padding-left: 6px; font-variant-numeric: tabular-nums; }

/* column chart */
.cols { display: flex; align-items: flex-end; gap: 2px; height: 160px; border-bottom: 1px solid var(--viz-axis); position: relative;
  background-image: linear-gradient(var(--viz-grid) 1px, transparent 1px); background-size: 100% 40px; background-position: 0 -1px; }
.cols .col-hit { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.cols .colbar { width: 100%; max-width: 24px; background: var(--viz-series-1); border-radius: 4px 4px 0 0; min-height: 0; }
.cols .col-hit:hover .colbar, .cols .col-hit:focus .colbar { filter: brightness(1.12); }
.cols-axis { display: flex; gap: 2px; font-size: .68rem; color: var(--viz-muted); margin-top: .3rem; }
.cols-axis span { flex: 1; text-align: center; white-space: nowrap; }

/* meter (programme completion) */
.meter { height: 8px; background: var(--viz-track); border-radius: 999px; overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--viz-series-1); border-radius: 999px; }

/* tooltip */
.viz-tip { position: fixed; pointer-events: none; z-index: 2000; background: #111827; color: #fff; padding: .45rem .6rem; border-radius: 8px; font-size: .78rem; line-height: 1.3; box-shadow: 0 6px 18px rgba(0,0,0,.2); opacity: 0; transition: opacity .1s; max-width: 260px; }
.viz-tip.show { opacity: 1; }
.viz-tip .v { font-size: .95rem; font-weight: 700; display: block; }
.viz-tip .k { color: #d1d5db; }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: .7rem; padding: .65rem 1rem; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; }
.feed .meta { font-size: .75rem; color: var(--ink-3); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; }
.login-brand {
  flex: 1 1 50%; background: linear-gradient(150deg, var(--brand) 0%, var(--brand-darker) 100%); color: #fff;
  display: flex; flex-direction: column; justify-content: center; padding: 3rem; position: relative; overflow: hidden;
}
.login-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 50px solid rgba(212,160,23,.15); }
.login-brand img { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 18px; padding: 6px; }
.login-brand h1 { font-size: 1.8rem; font-weight: 700; margin: 1.25rem 0 .25rem; }
.login-brand .addr { color: #f1d9d9; }
.login-brand .exam { display: inline-block; margin-top: 1.5rem; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); padding: .5rem .9rem; border-radius: 10px; font-weight: 600; }
.login-brand .steps { margin-top: 1.75rem; font-size: .88rem; color: #f1d9d9; }
.login-brand .steps span { display: inline-block; background: rgba(0,0,0,.18); border-radius: 999px; padding: .2rem .65rem; margin: .15rem .1rem; }
.login-form-side { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--page); }
.login-card { width: 100%; max-width: 420px; }
@media (max-width: 991.98px) {
  .login-wrap { flex-direction: column; }
  .login-brand { padding: 2rem 1.25rem; flex: none; }
  .login-brand h1 { font-size: 1.3rem; }
  .login-brand img { width: 64px; height: 64px; }
  .login-brand .steps { display: none; }
}

/* ---------- Student status hero ---------- */
.status-hero { border-radius: var(--radius); padding: 1.25rem 1.4rem; color: #fff; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.status-hero .big-ic { font-size: 2.2rem; line-height: 1; }
.status-hero h2 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.status-hero.s-approved { background: linear-gradient(135deg, #0b7d0b, #075c07); }
.status-hero.s-pending  { background: linear-gradient(135deg, #8a5a00, #6b4500); }
.status-hero.s-rejected { background: linear-gradient(135deg, #b02f2f, #861f1f); }
.status-hero.s-none     { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.status-hero .progress { height: 8px; background: rgba(255,255,255,.25); }
.status-hero .progress-bar { background: #fff; }

/* Approval timeline */
.timeline { list-style: none; padding-left: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: .6rem .8rem .6rem 2.2rem; border-left: 3px solid #e5e7eb; margin-left: .7rem; }
.timeline li::before {
  content: ""; position: absolute; left: -.6rem; top: .9rem; width: 1rem; height: 1rem;
  border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1;
}
.timeline li.tl-approved { border-left-color: var(--status-good); }
.timeline li.tl-approved::before { background: var(--status-good); box-shadow: 0 0 0 1px var(--status-good); }
.timeline li.tl-rejected { border-left-color: var(--status-critical); }
.timeline li.tl-rejected::before { background: var(--status-critical); box-shadow: 0 0 0 1px var(--status-critical); }
.timeline li.tl-current::before { background: #0d6efd; box-shadow: 0 0 0 4px rgba(13,110,253,.25); }

/* ---------- Certificate & print ---------- */
.certificate { background: #fff; max-width: 820px; margin: 0 auto; padding: 2rem 2.5rem; border: 2px solid var(--brand); }
.certificate .cert-head { text-align: center; border-bottom: 2px solid var(--accent); padding-bottom: 1rem; margin-bottom: 1rem; }
.certificate .cert-head img { height: 90px; }
@media print {
  .no-print, .college-header, .app-nav, .app-footer, .sidebar, .topbar, .content-footer, .sidebar-backdrop { display: none !important; }
  body { background: #fff; }
  .shell { display: block; }
  main, .content { margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
  .certificate { border: 2px solid #000; }
  .card, .table-responsive.bg-white, .report-sheet { box-shadow: none !important; border: 0 !important; }
}

/* ==========================================================================
   Mobile view
   ========================================================================== */
.topbar .college-short { display: none; font-weight: 700; color: var(--brand); }
@media (max-width: 991.98px) { .topbar .college-short { display: inline; } }

/* Bottom tab bar for staff/admin on phones & tablets */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 14px rgba(0,0,0,.06);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0 .4rem;
  font-size: .68rem; color: var(--ink-3); text-decoration: none; position: relative; }
.tabbar a i { font-size: 1.2rem; }
.tabbar a.active { color: var(--brand); font-weight: 600; }
.tabbar .tab-count { position: absolute; top: 3px; left: 54%; background: var(--status-critical); color: #fff; font-size: .62rem;
  border-radius: 999px; padding: 0 .35rem; line-height: 1.35; }
@media (max-width: 991.98px) {
  body.has-tabbar .content-footer { padding-bottom: 5rem; }
  body.has-tabbar .content { padding-bottom: 1rem; }
}

/* Tables → stacked cards on phones (add class .table-cards) */
@media (max-width: 767.98px) {
  table.table-cards thead { display: none; }
  table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
  table.table-cards tr { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 0 0 .65rem; padding: .35rem .75rem; box-shadow: var(--shadow); }
  table.table-cards td { border: 0 !important; padding: .28rem 0 !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; max-width: none !important; }
  table.table-cards td::before { content: attr(data-label); font-weight: 600; color: var(--ink-3); text-align: left; font-size: .78rem; flex: 0 0 auto; }
  table.table-cards td[data-label=""]::before { content: none; }
  table.table-cards td:first-child { font-weight: 700; color: var(--ink); }
  table.table-cards td.td-actions { justify-content: flex-end; gap: .4rem; flex-wrap: wrap; border-top: 1px solid var(--border) !important; margin-top: .25rem; padding-top: .5rem !important; }
  table.table-cards td.td-actions::before { content: none; }
  table.table-cards tr.empty-row td { justify-content: center; }
  table.table-cards tr.empty-row td::before { content: none; }
  .table-responsive.bg-white:has(table.table-cards) { background: transparent !important; border: 0; box-shadow: none !important; }

  .page-head h1 { font-size: 1.2rem; }
  .stat-tile { padding: .8rem .9rem; }
  .stat-tile .value { font-size: 1.45rem; }
  .card-body { padding: .9rem; }
  .btn-group-mobile-full > .btn, .btn-group-mobile-full > form, .btn-group-mobile-full > a { flex: 1 1 auto; }
  .hbars { grid-template-columns: minmax(90px, 40%) 1fr; }
  .cols { height: 130px; }
}

/* Sticky approve/reject bar for approvers on phones */
.action-bar { display: none; }
@media (max-width: 991.98px) {
  .action-bar { display: flex; gap: .5rem; position: fixed; left: 0; right: 0; bottom: 56px; z-index: 1025;
    background: var(--surface); padding: .6rem .75rem; border-top: 1px solid var(--border); box-shadow: 0 -4px 14px rgba(0,0,0,.08); }
  .action-bar .btn { flex: 1; }
  body.has-action-bar .content { padding-bottom: 5.5rem; }
}
@media (max-width: 767.98px) {
  .app-nav .navbar-brand { font-size: .9rem; max-width: 80%; white-space: normal; line-height: 1.3; }
  .status-hero { padding: 1rem; }
  .status-hero .big-ic { font-size: 1.8rem; }
  .status-hero h2 { font-size: 1.05rem; }
}
@media (max-width: 991.98px) {
  .login-form-side { align-items: flex-start; padding-top: 1.5rem; flex: 1 0 auto; }
}
