/* ==========================================================================
   SmartAdmit parent portal - LEGACY MARKUP BRIDGE
   --------------------------------------------------------------------------
   Most pages behind the parent sign-in - the learner and application wizards,
   uploads, complaints, the guardian details form - are written in Bootstrap
   5.1 markup and are NOT rewritten for the redesign. They carry the whole of
   the admissions workflow: field names, validation, the modal flows, the
   select2 school pickers. Rewriting 1.5 MB of that markup to change how it
   looks is how a placement bug gets shipped.

   So they render unchanged inside the new shell, and this file restyles the
   Bootstrap vocabulary they use onto BCDF's look: cards, tables, buttons,
   inputs, alerts, tabs, modals, badges. Every rule is scoped to a shell
   container, and targets Bootstrap/theme CLASSES rather than bare elements,
   so the redesigned pages - which use bc-* classes - are never touched by it.

   Scopes
     .sa-content      the signed-in portal's content area
     .sa-legacy-page  an un-redesigned page on the public site (Register, About)
     .sa-auth__form   the sign-in form panel (the Identity pages, unedited)
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. The page skeleton every legacy view repeats:
      main#main > section.section-bg > .container > .section-header > h3
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page, .sa-auth__form) #main { padding: 0; margin: 0; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .section-bg { background: transparent; padding: 0; }
.sa-content .container, .sa-content .container-fluid,
.sa-auth__form .container { max-width: none; padding-left: 0; padding-right: 0; }
.sa-legacy-page { padding-block: var(--bc-s-9) var(--bc-s-11); }

:is(.sa-content, .sa-legacy-page, .sa-auth__form) .section-header { margin: 0 0 var(--bc-s-6); padding: 0; text-align: left; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .section-header h3 {
  font-family: var(--bc-font-display); font-size: var(--bc-fs-h2); font-weight: var(--bc-fw-semi);
  color: var(--bc-text-strong); letter-spacing: -.02em; line-height: 1.2; text-transform: none; margin: 0; padding: 0; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .section-header h3::before,
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .section-header h3::after { content: none; display: none; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .section-header p { color: var(--bc-text-muted); margin: 6px 0 0; text-align: left; }
/* Legacy pages space their heading and action row with <br /> tags; the new
   heading and the shortcut row carry their own margins. */
.sa-content > br, .sa-content > #main > br { display: none; }

/* Porto's scroll-in animations need Porto's script, which the new shell does
   not load. Without this the elements would stay invisible. */
:is(.sa-content, .sa-legacy-page) .appear-animation { opacity: 1 !important; }

/* --------------------------------------------------------------------------
   1. BUTTONS
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--bc-font-body); font-weight: var(--bc-fw-semi); font-size: var(--bc-fs-sm);
  border-radius: var(--bc-r-btn); padding: .55rem 1.05rem; line-height: 1.35; border-width: 1px;
  transition: background-color var(--bc-transition), border-color var(--bc-transition), box-shadow var(--bc-transition), color var(--bc-transition);
  white-space: normal; flex-wrap: wrap; text-align: center; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .btn-lg { padding: .75rem 1.35rem; font-size: var(--bc-fs-base); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .btn-sm { padding: .35rem .75rem; font-size: var(--bc-fs-xs); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .btn:focus-visible { box-shadow: var(--bc-focus-ring); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .btn .d-block.small { display: block; width: 100%; font-weight: var(--bc-fw-regular); opacity: .85; }

:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-primary, .btn-info) {
  background: var(--bc-accent-500); border-color: var(--bc-accent-500); color: #fff;
  box-shadow: 0 2px 8px var(--sa-shadow-brand); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-primary, .btn-info):hover {
  background: var(--bc-accent-600); border-color: var(--bc-accent-600); color: #fff; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-primary, .btn-info):disabled,
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-primary, .btn-info).disabled {
  background: var(--bc-accent-50); border-color: var(--bc-accent-100); color: var(--bc-accent-700); box-shadow: none; opacity: 1; }

:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-success, .btn-secondary, .btn-default, .btn-light, .btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-dark) {
  background: #fff; border-color: var(--bc-border-strong); color: var(--bc-text-strong); box-shadow: var(--bc-sh-xs); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-success, .btn-secondary, .btn-default, .btn-light, .btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-dark):hover {
  background: var(--bc-accent-50); border-color: var(--bc-accent-300); color: var(--bc-accent-700); }

:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-warning, .btn-outline-warning) {
  background: var(--bc-warning-bg); border-color: color-mix(in srgb, var(--bc-warning) 45%, #fff); color: var(--bc-warning-fg); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-warning, .btn-outline-warning):hover {
  background: color-mix(in srgb, var(--bc-warning) 28%, #fff); color: var(--bc-warning-fg); }

:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-danger, .btn-outline-danger) {
  background: var(--bc-danger-bg); border-color: color-mix(in srgb, var(--bc-danger) 35%, #fff); color: var(--bc-danger-fg); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.btn-danger, .btn-outline-danger):hover {
  background: var(--bc-danger); border-color: var(--bc-danger); color: #fff; }

:is(.sa-content, .sa-legacy-page, .sa-auth__form) .btn-link { color: var(--bc-accent-600); box-shadow: none; }

/* --------------------------------------------------------------------------
   2. CARDS, WELLS, PANELS
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page) .card {
  border: 1px solid var(--bc-border); border-radius: var(--bc-r-card); box-shadow: var(--bc-sh-sm); background: #fff; overflow: hidden; }
:is(.sa-content, .sa-legacy-page) .card-header {
  background: #fff; border-bottom: 1px solid var(--bc-border-subtle); padding: var(--bc-s-4) var(--bc-s-5);
  font-family: var(--bc-font-display); font-weight: var(--bc-fw-semi); color: var(--bc-text-strong); }
:is(.sa-content, .sa-legacy-page) .card-body { padding: var(--bc-s-5); }
:is(.sa-content, .sa-legacy-page) .card-footer { background: var(--bc-grey-25); border-top: 1px solid var(--bc-border-subtle); }
:is(.sa-content, .sa-legacy-page) .shadow-sm, :is(.sa-content, .sa-legacy-page) .shadow { box-shadow: var(--bc-sh-sm) !important; }

/* --------------------------------------------------------------------------
   3. TABLES
   The legacy lists are Bootstrap tables with every border switched on. They
   become BCDF registers: one card, hairline rows, quiet headings.
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page) .table-responsive {
  background: #fff; border: 1px solid var(--bc-border); border-radius: var(--bc-r-card); box-shadow: var(--bc-sh-sm); }
:is(.sa-content, .sa-legacy-page) .table { margin-bottom: 0; color: var(--bc-text-body); font-size: var(--bc-fs-sm);
  --bs-table-striped-bg: var(--bc-grey-25); --bs-table-hover-bg: var(--bc-accent-50); vertical-align: middle; }
:is(.sa-content, .sa-legacy-page) .table > :not(caption) > * > * { padding: 14px 16px; border-bottom-color: var(--bc-border-subtle); }
:is(.sa-content, .sa-legacy-page) .table-bordered > :not(caption) > * { border-width: 0; }
:is(.sa-content, .sa-legacy-page) .table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; }
:is(.sa-content, .sa-legacy-page) .table > thead > tr > th, :is(.sa-content, .sa-legacy-page) .table > thead > tr > td {
  background: var(--bc-grey-25); color: var(--bc-text-muted); font-size: var(--bc-fs-xs); font-weight: var(--bc-fw-semi);
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--bc-border); }
:is(.sa-content, .sa-legacy-page) .table > tbody > tr:last-child > * { border-bottom-width: 0; }
:is(.sa-content, .sa-legacy-page) .table > :not(:first-child) { border-top: 0; }

/* --------------------------------------------------------------------------
   4. FORMS
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.form-control, .form-select) {
  min-height: 44px; border: 1px solid var(--bc-border-strong); border-radius: var(--bc-r-ctrl);
  font-size: var(--bc-fs-base); color: var(--bc-text-strong); background-color: #fff; padding: .55rem .85rem;
  transition: border-color var(--bc-transition), box-shadow var(--bc-transition); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) textarea.form-control { min-height: 96px; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.form-control, .form-select):focus {
  border-color: var(--bc-accent-500); box-shadow: var(--bc-focus-ring); outline: 0; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.form-control, .form-select):disabled,
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .form-control[readonly] {
  background: var(--bc-grey-50); border-color: var(--bc-border); color: var(--bc-text-muted); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .form-control::placeholder { color: var(--bc-text-subtle); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.form-label, .control-label, .col-form-label) {
  font-size: var(--bc-fs-sm); font-weight: var(--bc-fw-semi); color: var(--bc-text-strong); margin-bottom: 6px; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .form-check-input:checked { background-color: var(--bc-accent-500); border-color: var(--bc-accent-500); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .form-check-input:focus { box-shadow: var(--bc-focus-ring); border-color: var(--bc-accent-500); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) :is(.text-danger, .field-validation-error) { color: var(--bc-danger-fg) !important; font-size: var(--bc-fs-sm); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .validation-summary-errors ul { margin: 0 0 var(--bc-s-4); padding: 12px 16px 12px 32px;
  background: var(--bc-danger-bg); border-radius: var(--bc-r-ctrl); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .input-group > .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .input-group > .btn { border-radius: 0 var(--bc-r-ctrl) var(--bc-r-ctrl) 0; box-shadow: none; }

/* select2 - the school and suburb pickers */
:is(.sa-content, .sa-legacy-page) .select2-container--default .select2-selection--single,
:is(.sa-content, .sa-legacy-page) .select2-container--default .select2-selection--multiple {
  min-height: 44px; border: 1px solid var(--bc-border-strong); border-radius: var(--bc-r-ctrl); }
:is(.sa-content, .sa-legacy-page) .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 42px; padding-left: 12px; color: var(--bc-text-strong); }
:is(.sa-content, .sa-legacy-page) .select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px; right: 8px; }
:is(.sa-content, .sa-legacy-page) .select2-container--default.select2-container--focus .select2-selection--single,
:is(.sa-content, .sa-legacy-page) .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--bc-accent-500); box-shadow: var(--bc-focus-ring); }
.sa-shell .select2-dropdown { border-color: var(--bc-border-strong); border-radius: var(--bc-r-ctrl); box-shadow: var(--bc-sh-lg); overflow: hidden; }
.sa-shell .select2-container--default .select2-results__option--highlighted[aria-selected],
.sa-shell .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--bc-accent-500); }

/* --------------------------------------------------------------------------
   5. ALERTS, BADGES
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .alert { border-radius: var(--bc-r-card); border: 1px solid transparent; padding: var(--bc-s-4) var(--bc-s-5); font-size: var(--bc-fs-sm); line-height: 1.6; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .alert-info { background: var(--bc-info-bg); color: var(--bc-info-fg); border-color: color-mix(in srgb, var(--bc-info) 22%, #fff); border-left-color: var(--bc-info) !important; }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .alert-success { background: var(--bc-success-bg); color: var(--bc-success-fg); border-color: color-mix(in srgb, var(--bc-success) 22%, #fff); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .alert-warning { background: var(--bc-warning-bg); color: var(--bc-warning-fg); border-color: color-mix(in srgb, var(--bc-warning) 30%, #fff); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .alert-danger { background: var(--bc-danger-bg); color: var(--bc-danger-fg); border-color: color-mix(in srgb, var(--bc-danger) 22%, #fff); }
:is(.sa-content, .sa-legacy-page, .sa-auth__form) .alert h5 { color: inherit; }

:is(.sa-content, .sa-legacy-page) .badge { border-radius: var(--bc-r-pill); font-weight: var(--bc-fw-semi); padding: .4em .75em; letter-spacing: .01em; }
:is(.sa-content, .sa-legacy-page) .badge.bg-primary { background-color: var(--bc-accent-500) !important; }
:is(.sa-content, .sa-legacy-page) .badge.bg-success { background-color: var(--bc-success-bg) !important; color: var(--bc-success-fg); }
:is(.sa-content, .sa-legacy-page) .badge.bg-warning { background-color: var(--bc-warning-bg) !important; color: var(--bc-warning-fg) !important; }
:is(.sa-content, .sa-legacy-page) .badge.bg-danger { background-color: var(--bc-danger-bg) !important; color: var(--bc-danger-fg); }
:is(.sa-content, .sa-legacy-page) .badge.bg-light { background-color: var(--bc-grey-50) !important; }

/* --------------------------------------------------------------------------
   6. TABS, PILLS, PROGRESS, ACCORDION
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page) .nav-tabs { border-bottom: 1px solid var(--bc-border); gap: var(--bc-s-5); }
:is(.sa-content, .sa-legacy-page) .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px 2px; color: var(--bc-text-muted); font-weight: var(--bc-fw-medium); background: none; }
:is(.sa-content, .sa-legacy-page) .nav-tabs .nav-link.active { color: var(--bc-text-strong); border-bottom-color: var(--bc-accent-500); font-weight: var(--bc-fw-semi); }
:is(.sa-content, .sa-legacy-page) .nav-pills .nav-link.active { background: var(--bc-accent-500); }
:is(.sa-content, .sa-legacy-page) .progress { height: 8px; border-radius: var(--bc-r-pill); background: var(--bc-grey-100); }
:is(.sa-content, .sa-legacy-page) .progress-bar { background: var(--bc-accent-500); }
:is(.sa-content, .sa-legacy-page) .accordion-button:not(.collapsed) { background: var(--bc-accent-50); color: var(--bc-accent-700); }
:is(.sa-content, .sa-legacy-page) .accordion-item { border-color: var(--bc-border); }
:is(.sa-content, .sa-legacy-page) .accordion-item:first-of-type, :is(.sa-content, .sa-legacy-page) .accordion-item:first-of-type .accordion-button { border-top-left-radius: var(--bc-r-card); border-top-right-radius: var(--bc-r-card); }

/* --------------------------------------------------------------------------
   7. MODALS - rendered at body level, so scoped to the shell
   -------------------------------------------------------------------------- */
.sa-shell .modal-content { border: 0; border-radius: var(--bc-r-lg); box-shadow: var(--bc-sh-xl); overflow: hidden; }
.sa-shell .modal-header { border-bottom: 1px solid var(--bc-border-subtle); padding: var(--bc-s-5) var(--bc-s-6); }
.sa-shell .modal-title { font-family: var(--bc-font-display); font-weight: var(--bc-fw-semi); color: var(--bc-text-strong); }
.sa-shell .modal-body { padding: var(--bc-s-6); }
.sa-shell .modal-footer { border-top: 1px solid var(--bc-border-subtle); padding: var(--bc-s-4) var(--bc-s-6); background: var(--bc-grey-25); }
.sa-shell .modal .btn { border-radius: var(--bc-r-btn); font-weight: var(--bc-fw-semi); }
.sa-shell .modal .btn-primary { background: var(--bc-accent-500); border-color: var(--bc-accent-500); }
.sa-shell .modal .btn-primary:hover { background: var(--bc-accent-600); border-color: var(--bc-accent-600); }

/* --------------------------------------------------------------------------
   8. THEME COLOUR UTILITIES
   Bootstrap's and Porto's "primary" are blue and whatever Porto's skin set.
   The old pages use them to mean "the brand colour"; now they do.
   -------------------------------------------------------------------------- */
:is(.sa-content, .sa-legacy-page) :is(.text-primary, .text-color-primary) { color: var(--bc-accent-600) !important; }
:is(.sa-content, .sa-legacy-page) :is(.bg-primary, .bg-color-primary) { background-color: var(--bc-accent-500) !important; }
:is(.sa-content, .sa-legacy-page) .border-primary { border-color: var(--bc-accent-500) !important; }
:is(.sa-content, .sa-legacy-page) :is(.text-color-dark, .text-dark) { color: var(--bc-text-strong) !important; }
:is(.sa-content, .sa-legacy-page) :is(.text-color-grey, .text-muted) { color: var(--bc-text-muted) !important; }
:is(.sa-content, .sa-legacy-page) .text-color-light { color: #fff !important; }
:is(.sa-content, .sa-legacy-page) .font-weight-semibold, :is(.sa-content, .sa-legacy-page) .font-weight-semi-bold { font-weight: var(--bc-fw-semi); }
:is(.sa-content, .sa-legacy-page) .font-weight-bold { font-weight: var(--bc-fw-bold); }

/* --------------------------------------------------------------------------
   9. SIGN-IN FORM
   The Identity pages are left as written; this lays their skeleton into the
   auth panel as one full-width form (max 560px). The one primary action
   stays filled; "Register" (btn-success) is the secondary.
   -------------------------------------------------------------------------- */
.sa-auth__form .section-header { margin-bottom: var(--bc-s-6); }
.sa-auth__form .section-header h3 { font-size: var(--bc-fs-h1); }
.sa-auth__form .contact-info:empty { display: none; }
.sa-auth__form .form .col-md-12 { width: 100%; }
.sa-auth__form .d-grid.gap-3 { gap: var(--bc-s-4) !important; }
.sa-auth__form br { display: none; }
.sa-auth__form .d-grid.gap-2 { gap: var(--bc-s-3) !important; margin-top: var(--bc-s-6); }
.sa-auth__form .btn-lg { min-height: 52px; font-size: var(--bc-fs-base); }
.sa-auth__form #forgot-password { font-weight: var(--bc-fw-semi); }
.sa-auth__form .form > p, .sa-auth__form form > p { margin-top: var(--bc-s-5); margin-bottom: 0; font-size: var(--bc-fs-sm); }
.sa-auth__form .row { --bs-gutter-x: 0; }
.sa-auth__form .input-group > .btn { min-width: 52px; }
.sa-auth__form .form-control::placeholder { color: var(--bc-text-muted); }

/* --------------------------------------------------------------------------
   10. COLLAPSIBLE SECTION CARDS (Learners/EditV2)
   Guardians/EditV2 now has its own Portal view; the learner edit page still
   styles its section headers inline with Limpopo's green as a literal gradient. In the portal they become BCDF card heads - white, the
   title in the heading face, the chevron quiet - so the page reads like the
   Nala profile screen and takes the province's colour, not Limpopo's.
   Three classes deep to outrank the page's own <style> block.
   -------------------------------------------------------------------------- */
.sa-content .edit-wizard { max-width: 920px; }
.sa-content .section-card.card, .sa-content .section-card {
  border: 1px solid var(--bc-border); border-radius: var(--bc-r-card); box-shadow: var(--bc-sh-sm); margin-bottom: var(--bc-s-5); }
.sa-content .section-card .card-header {
  background: #fff; color: var(--bc-text-strong); padding: var(--bc-s-4) var(--bc-s-6);
  border-bottom: 1px solid var(--bc-border-subtle); }
.sa-content .section-card .card-header h6 {
  font-family: var(--bc-font-display); font-size: 1.05rem; font-weight: var(--bc-fw-semi); color: var(--bc-text-strong); }
.sa-content .section-card .card-header i { color: var(--bc-text-muted); }
.sa-content .section-card .card-header:hover { background: var(--bc-grey-25); }
.sa-content .section-card .card-body { padding: var(--bc-s-6); }
.sa-content .field-locked { background: var(--bc-grey-50) !important; }
.sa-content .bg-light.border.rounded { background: var(--bc-grey-25) !important; border-color: var(--bc-border-subtle) !important; border-radius: var(--bc-r-ctrl) !important; }
