/* ============================================================
   SKOOLSET — Custom theme layer
   Brand overrides + component styling for the AdminLTE 4 base.
   Loaded AFTER css/adminlte.css so these rules win.
   Do not edit adminlte.css directly — that stays a clean vendor
   file so template updates don't clobber our customizations.
   Palette + type sourced from the Skoolset brand theme (Nunito,
   ink/blue/aqua/sun/mist).
   ============================================================ */

:root {
  --skoolset-ink: #14245E;
  --skoolset-blue: #2447B8;
  --skoolset-aqua: #14B8D4;
  --skoolset-aqua-light: #5CD3E6;
  --skoolset-mist: #F3F6FC;
  --skoolset-sun: #FFC533;
  --skoolset-mint: #DDF5EC;
  --skoolset-mint-ink: #0F7A55;
  --skoolset-line: #E3E9F5;
  --skoolset-muted: #5F6B8A;
  --bs-body-font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-primary: var(--skoolset-blue);
  --bs-primary-rgb: 36, 71, 184;
  --bs-link-color: var(--skoolset-blue);
  --bs-link-hover-color: var(--skoolset-aqua);
}

body {
  background: var(--skoolset-mist) !important;
  color: var(--skoolset-ink);
}

.app-header {
  border-bottom: 1px solid rgba(23, 37, 84, 0.1);
  background: rgba(248, 250, 252, 0.96) !important;
}

.app-header .nav-link,
.app-header .navbar-search-submit {
  color: var(--skoolset-ink);
}

.app-header .nav-link:hover,
.app-header .navbar-search-submit:hover {
  color: var(--skoolset-aqua);
}

.app-sidebar {
  background: var(--skoolset-ink) !important;
}

.sidebar-brand {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-link {
  min-height: 74px;
}

.brand-image {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-left: 0.45rem;
  margin-right: 0.7rem;
}

.brand-text {
  color: #fff;
  font-weight: 700 !important;
  letter-spacing: -0.03em;
}

.sidebar-search .form-control {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-menu .nav-link.active {
  background: var(--skoolset-aqua);
  color: var(--skoolset-ink);
  font-weight: 700;
}

.sidebar-menu .nav-link:hover:not(.active) {
  background: rgba(34, 211, 238, 0.14);
  color: var(--skoolset-aqua-light);
}

/*
 * Parent portal sidebar (partials/parent-sidebar.php, added 2026-10-10)
 * -- same .app-sidebar markup shape as the staff sidebar above, but
 * deliberately kept on the parent portal's existing LIGHT background
 * rather than inheriting the staff sidebar's dark --skoolset-ink fill.
 * The .app-sidebar rule above is !important, so this needs the extra
 * .parent-app-sidebar class to win on specificity, not just override
 * order. Every rule below re-themes a staff-sidebar style that assumed
 * a dark background (white brand text, white-tinted hover/border
 * overlays, a light hover-text color) for a light one instead; the
 * active-state pill (aqua bg / ink text) already works unchanged on
 * either background, so it's not repeated here.
 */
.app-sidebar.parent-app-sidebar {
  background: var(--bs-body-bg) !important;
}

.parent-app-sidebar .sidebar-brand {
  background: transparent;
  border-bottom: 1px solid var(--skoolset-line);
}

.parent-app-sidebar .brand-text {
  color: var(--skoolset-ink);
}

.parent-app-sidebar .sidebar-menu .nav-link {
  color: var(--skoolset-muted);
}

.parent-app-sidebar .sidebar-menu .nav-link:hover:not(.active) {
  background: var(--skoolset-mist);
  color: var(--skoolset-blue);
}

.small-box.text-bg-primary,
.bg-primary {
  background-color: var(--skoolset-blue) !important;
}

.small-box.text-bg-info {
  background-color: var(--skoolset-aqua) !important;
}

.small-box.text-bg-dark {
  background-color: var(--skoolset-ink) !important;
}

.btn-primary {
  --bs-btn-bg: var(--skoolset-blue);
  --bs-btn-border-color: var(--skoolset-blue);
  --bs-btn-hover-bg: var(--skoolset-ink);
  --bs-btn-hover-border-color: var(--skoolset-ink);
}

.card-title,
.app-content-header h1 {
  color: var(--skoolset-ink);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* ---- Dashboard-specific additions ---- */
.quick-action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.1rem 0.5rem;
  border: 1px solid rgba(23, 37, 84, 0.1);
  border-radius: 0.5rem;
  color: var(--skoolset-ink);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  height: 100%;
}

.quick-action-tile:hover {
  border-color: var(--skoolset-aqua);
  background: rgba(34, 211, 238, 0.08);
  color: var(--skoolset-ink);
}

.quick-action-tile i {
  font-size: 1.4rem;
  color: var(--skoolset-blue);
}

.quick-action-tile span {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}

.activity-list .list-group-item {
  border: none;
  border-bottom: 1px solid rgba(23, 37, 84, 0.08);
  padding-left: 0;
  padding-right: 0;
}

.activity-list .list-group-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.6rem;
  flex-shrink: 0;
}

/* ---- Login page ---- */
.login-page {
  background: linear-gradient(160deg, var(--skoolset-ink) 0%, var(--skoolset-blue) 60%, #0e7490 100%);
}

.login-box .card {
  border-radius: 0.75rem;
  overflow: hidden;
}

.login-box .card-outline.card-primary {
  border-top: 3px solid var(--skoolset-aqua);
}

.login-logo-img {
  max-height: 44px;
  width: auto;
}

.login-box-msg {
  text-align: center;
  color: var(--skoolset-ink);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

#loginTab .nav-link {
  color: var(--skoolset-ink);
  font-weight: 600;
}

#loginTab .nav-link.active {
  color: var(--skoolset-blue);
  border-bottom: 2px solid var(--skoolset-aqua);
}

/* ---- Public pages (privacy-policy.php, student-dashboard.php) ----
   index.php no longer uses these — it's now a fully self-contained page
   with its own inline <style> block (see that file's ARCHITECTURE NOTE
   docblock) and no longer includes partials/head.php. These rules stay
   because privacy-policy.php and student-dashboard.php still use
   .public-header / .public-header-logo / .public-header-name /
   .public-info-card / .public-footer. ---- */
.public-header {
  background: #fff;
  border-bottom: 1px solid rgba(23, 37, 84, 0.1);
}

.public-header-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.public-header-name {
  font-weight: 800;
  color: var(--skoolset-ink);
  font-size: 1.05rem;
}

.public-hero {
  background-image: linear-gradient(rgba(23, 37, 84, 0.68), rgba(23, 37, 84, 0.68)), url('../assets/img/sks_at_mass.jpg');
  background-position: center;
  background-size: cover;
  padding: 4.5rem 0 5rem;
}

.public-hero-overlay {
  text-align: center;
  color: #fff;
}

.public-hero-crest {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

.public-hero h1 {
  font-weight: 800;
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
}

.public-hero-motto {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.85);
  font-style: italic;
}

.public-info-card {
  border: 1px solid rgba(23, 37, 84, 0.08);
  border-radius: 0.75rem;
}

.public-info-card .card-title {
  float: none;
  display: block;
  margin-bottom: 0.6rem;
  color: var(--skoolset-ink);
}

.public-info-icon {
  font-size: 1.8rem;
  color: var(--skoolset-aqua);
  margin-bottom: 0.6rem;
  display: block;
}

.public-footer {
  background: var(--skoolset-ink);
  color: rgba(255, 255, 255, 0.85);
}

/* ---- Term Setup — shared patterns ---- */
.locked-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 0.5rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
}

.locked-banner i {
  font-size: 1.2rem;
  color: #c2410c;
  margin-top: 0.1rem;
}

.locked-banner strong {
  color: #9a3412;
}

.unlocked-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 0.5rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
}

.unlocked-banner i {
  font-size: 1.2rem;
  color: #047857;
  margin-top: 0.1rem;
}

.builder-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.builder-row .form-control {
  flex: 1;
}

.builder-row .builder-max {
  max-width: 110px;
  flex: none;
}

.builder-remove {
  color: #b91c1c;
  background: none;
  border: none;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  flex: none;
}

.builder-remove:hover {
  color: #7f1d1d;
}

.builder-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 700;
  margin-top: 0.75rem;
}

.builder-total.total-ok {
  background: #ecfdf5;
  color: #047857;
}

.builder-total.total-bad {
  background: #fef2f2;
  color: #b91c1c;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(23, 37, 84, 0.08);
  border-radius: 0.6rem;
  margin-bottom: 0.75rem;
}

.checklist-status {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: #fff;
}

.checklist-status.done {
  background: var(--skoolset-aqua);
}

.checklist-status.pending {
  background: #cbd5e1;
  color: #64748b;
}

.checklist-item .checklist-body {
  flex: 1;
}

.checklist-item .checklist-body h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--skoolset-ink);
}

.checklist-item .checklist-body p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--skoolset-ink);
  opacity: 0.65;
}

.level-tabs .nav-link {
  font-weight: 600;
}

.signature-preview {
  width: 140px;
  height: 90px;
  border: 1px dashed rgba(23, 37, 84, 0.25);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  flex-shrink: 0;
}

.signature-preview img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

/* ---- Results workflow — shared patterns ---- */
.entry-table th, .entry-table td {
  vertical-align: middle;
}

.entry-table input[type="number"] {
  width: 70px;
  text-align: center;
  padding: 0.25rem 0.4rem;
}

.entry-total-cell {
  font-weight: 700;
  color: var(--skoolset-ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill.st-computed { background: #e0f2fe; color: #0369a1; }
.status-pill.st-verified { background: #fef3c7; color: #92400e; }
.status-pill.st-released { background: #d1fae5; color: #047857; }
.status-pill.st-missing  { background: #fee2e2; color: #b91c1c; }

.upload-drop {
  border: 2px dashed rgba(23, 37, 84, 0.2);
  border-radius: 0.75rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--skoolset-ink);
}

.upload-drop i {
  font-size: 2rem;
  color: var(--skoolset-aqua);
  margin-bottom: 0.5rem;
  display: block;
}

.student-picker-list {
  max-height: 560px;
  overflow-y: auto;
}

.student-picker-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.student-picker-item:hover {
  background: rgba(6, 182, 212, 0.08);
}

.student-picker-item.active {
  background: rgba(30, 58, 138, 0.08);
  border-color: var(--skoolset-blue);
}

/* Generic small circular avatar (initials) — used standalone in table rows
   (e.g. student-profiles.php) as well as inside .student-picker-item. */
.mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--skoolset-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Same 32px circular slot as .mini-avatar, but for an actual photo thumbnail. */
.mini-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.remark-auto-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--skoolset-aqua);
  background: rgba(6, 182, 212, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.result-header-band {
  background: linear-gradient(120deg, var(--skoolset-ink), var(--skoolset-blue));
  color: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem 1.75rem;
}

.result-header-band .avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.transcript-term-block {
  border: 1px solid rgba(23, 37, 84, 0.08);
  border-radius: 0.6rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

/* ---- Admin/System — shared patterns ---- */
.step-indicator {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.step-indicator .step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted, #64748b);
}

.step-indicator .step.active .step-circle {
  background: var(--skoolset-blue);
  color: #fff;
}

.step-indicator .step.done .step-circle {
  background: var(--skoolset-aqua);
  color: #fff;
}

.step-indicator .step-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-indicator .step-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.step-indicator .step.active .step-label,
.step-indicator .step.done .step-label {
  color: var(--skoolset-ink);
}

.step-indicator .step-connector {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  margin: 0 0.75rem;
}

.audit-detail-row {
  font-family: monospace;
  font-size: 0.78rem;
  background: #f8fafc;
  border-radius: 0.4rem;
  padding: 0.6rem 0.8rem;
  color: #475569;
  display: none;
}

/* ---- Letterhead (printed results) ---- */
.letterhead-bar {
  background: #fff;
  border: 1px solid rgba(23, 37, 84, 0.1);
  border-radius: 0.6rem;
  padding: 1rem 1.25rem;
}

.letterhead-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

.letterhead-school-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--skoolset-ink);
}

.letterhead-school-address {
  font-size: 0.8rem;
  color: #64748b;
}

.letterhead-passport {
  width: 64px;
  height: 72px;
  border: 1px solid rgba(23, 37, 84, 0.15);
  border-radius: 0.35rem;
  overflow: hidden;
  flex-shrink: 0;
}

.letterhead-passport img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Print stylesheet ----
   AdminLTE ships its own print rules that deliberately keep the
   sidebar/header/footer visible by default (a reasonable default for
   printing a data table with its nav for reference) — it exempts any
   element carrying AdminLTE/Bootstrap's own `d-print-none` utility
   class, which is now added directly to the sidebar/header/footer in
   the partials themselves (benefits every page, not just this one).
   .no-print handles everything else — on-screen-only controls that
   aren't part of AdminLTE's exemption system. */
@media print {
  .no-print {
    display: none !important;
  }

  .card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .result-header-band {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ============================================================
   Error toasts - js/app-errors.js (client half of ErrorHandler.php)
   ============================================================ */
#app-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.app-toast {
  position: relative;
  pointer-events: auto;
  padding: 12px 40px 12px 16px;
  background: #fff;
  color: var(--skoolset-ink);
  border-left: 4px solid var(--bs-danger, #dc3545);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(23, 37, 84, 0.18);
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: none;
}

.app-toast-title {
  display: block;
  margin-bottom: 2px;
}

.app-toast-body {
  color: #475569;
}

.app-toast-ref {
  margin-top: 6px;
  font: 600 0.75rem/1.3 Consolas, Menlo, monospace;
  color: #64748b;
  letter-spacing: 0.4px;
}

.app-toast-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: 0;
  background: none;
  font-size: 1.25rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.app-toast-close:hover {
  color: var(--skoolset-ink);
}

@media (prefers-reduced-motion: reduce) {
  .app-toast {
    transition: none;
  }
}

/* Entity search widget (js/entity-search.js + entity-search.php) — a
   lightweight suggestions dropdown for staff lookup fields (parent
   search on link-parent-student.php today; see entity-search.php's
   $typeConfig for what else it can search). */
.entity-search-wrap {
  position: relative;
}

.entity-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  margin-top: 2px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(23, 37, 84, 0.12);
  max-height: 260px;
  overflow-y: auto;
}

.entity-search-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
}

.entity-search-item:hover,
.entity-search-item:focus {
  background: #f1f5f9;
  outline: none;
}

.entity-search-item-label {
  font-weight: 600;
  color: var(--skoolset-ink, #14245E);
}

.entity-search-item-sublabel {
  color: #64748b;
  font-size: 0.78rem;
}

.entity-search-empty {
  padding: 10px 12px;
  color: #64748b;
  font-size: 0.82rem;
}

/* Collapsible cards + paginated tables (js/table-tools.js) — loaded
   globally (partials/scripts.php) so any card/table opts in via a
   data attribute; first used on link-parent-student.php's Existing
   Links / Unverified Parent Accounts cards. */
.collapsible-card-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.collapsible-card-header:focus-visible {
  outline: 2px solid var(--skoolset-ink, #14245E);
  outline-offset: -2px;
}

.collapsible-card-icon {
  color: #64748b;
  transition: transform 0.2s ease;
  flex: 0 0 auto;
  margin-left: 0.5rem;
}

.collapsible-card-header[aria-expanded="true"] .collapsible-card-icon {
  transform: rotate(180deg);
}

.table-tools-bar .form-select-sm {
  min-width: 4.5rem;
}

.table-tools-pagination .page-link {
  cursor: pointer;
}
