/*
 * Keep Vuexy authentication-specific layout rules scoped to the form area.
 * The active WordPress theme remains responsible for the site header, footer,
 * body spacing, and global typography.
 */
body.vfa-auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Support themes that place the whole site inside a #page or .site wrapper. */
body.vfa-auth-body > #page,
body.vfa-auth-body > .site {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}

/* Support themes that add a content wrapper between the header and this template. */
body.vfa-auth-body #content,
body.vfa-auth-body .site-content,
body.vfa-auth-body .content-area {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  width: 100%;
}

.vfa-auth-main {
  width: 100%;
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  background: var(--bs-body-bg, #f8f7fa);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.vfa-auth-root {
  width: 100%;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding-block-start: 2rem;
  padding-block-end: 2rem;
}

.vfa-auth-root .authentication-wrapper {
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.vfa-auth-root .authentication-inner {
  width: 100%;
  max-width: 430px;
}

/* The registration form has more fields than login/reset, so use a wider
 * desktop card. Login, verification and password-reset cards stay compact. */
@media (min-width: 768px) {
  .vfa-auth-root.vfa-register-root .authentication-wrapper.authentication-basic .authentication-inner {
    width: 100%;
    max-width: 860px;
    max-inline-size: 860px;
  }
}

/* Keep Vuexy's decorative authentication squares visible behind the card. */
.vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner::before,
.vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner::after {
  z-index: 0 !important;
  pointer-events: none;
}

.vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner > .card {
  position: relative;
  z-index: 1;
}

.vfa-auth-root .card {
  width: 100%;
}

.vfa-auth-root .card-body {
  padding: 2rem;
}

.vfa-auth-root .app-brand-link {
  text-decoration: none;
}

/* Avoid leftover spacing when the logo/icon is displayed without the name. */
.vfa-auth-root .app-brand-link.vfa-brand-logo-only .vfa-custom-logo,
.vfa-auth-root .app-brand-link.vfa-brand-logo-only .app-brand-logo {
  margin-inline-end: 0 !important;
}

.vfa-auth-root .vfa-custom-logo {
  display: inline-flex;
  align-items: center;
  margin-right: .75rem;
}

.vfa-auth-root .vfa-custom-logo img {
  display: block;
  width: auto;
  max-width: 150px;
  max-height: 54px;
  object-fit: contain;
}

.vfa-auth-root .vfa-alert,
.vfa-auth-root .vfa-alert:focus,
.vfa-auth-root .vfa-alert:focus-visible,
.vfa-auth-root [role="alert"],
.vfa-auth-root [role="alert"]:focus,
.vfa-auth-root [role="alert"]:focus-visible,
.vfa-auth-root [role="status"],
.vfa-auth-root [role="status"]:focus,
.vfa-auth-root [role="status"]:focus-visible {
  margin: 0 0 1.5rem;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}


/* Field icons on login and registration forms. These use Vuexy/Tabler's
 * existing input-group styling so page forms and popups look identical. */
.vfa-auth-root .vfa-input-with-icon .vfa-field-icon {
  flex: 0 0 auto;
  min-width: 2.75rem;
  padding-inline: .75rem;
  color: var(--bs-body-color, #6d6a7b);
  background: transparent;
  pointer-events: none;
}

.vfa-auth-root .vfa-input-with-icon .vfa-field-icon i {
  font-size: 1.1rem;
  line-height: 1;
}

/* Vuexy draws the merged input border with a pseudo-element. It must not sit
 * above the visibility control and intercept pointer events. */
.vfa-auth-root .input-group.input-group-merge::before,
.vfa-auth-root .input-group.input-group-merge::after {
  pointer-events: none !important;
}

.vfa-auth-root .vfa-password-toggle {
  position: relative;
  z-index: 3;
  pointer-events: auto !important;
  user-select: none;
  -webkit-user-select: none;
}

.vfa-auth-root .vfa-password-toggle i {
  pointer-events: none;
}

.vfa-auth-root .vfa-password-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.vfa-auth-root .vfa-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.vfa-auth-root .gap-3 {
  gap: 1rem;
}

.vfa-auth-root a {
  text-underline-offset: 2px;
}

@media (max-width: 575.98px) {
  /* On phones, begin directly below the theme header instead of centering. */
  .vfa-auth-main,
  .vfa-auth-root,
  .vfa-auth-root .authentication-wrapper {
    align-items: flex-start;
  }

  /* Keep only the same 1rem left/right gutters as the mobile navbar.
   * Remove the desktop vertical spacing on small screens. */
  .vfa-auth-root.container-xxl {
    max-width: none;
    padding: 0 1rem;
  }

  .vfa-auth-root .authentication-wrapper {
    width: 100%;
    margin: 0;
    padding: 0 !important;
    padding-block-start: 0 !important;
    padding-block-end: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    justify-content: flex-start;
  }

  /* Keep equal breathing room above and below the card on phones. Vuexy's
   * fixed-navbar rule already creates a 1.5rem top inset, so explicitly apply
   * the same inset to both ends using matching !important specificity. */
  .vfa-auth-root .authentication-wrapper.authentication-basic.container-p-y {
    padding-block: 1.5rem !important;
    padding-block-start: 1.5rem !important;
    padding-block-end: 1.5rem !important;
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* The Vuexy `py-6` utility is applied to authentication-inner and creates
   * the remaining highlighted space even after container-p-y is reset. */
  .vfa-auth-root .authentication-wrapper .authentication-inner.py-6 {
    padding-block: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* Vuexy limits this element with max-inline-size rather than max-width.
   * Override both so there is no unused strip on the right. */
  .vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner {
    width: 100% !important;
    inline-size: 100% !important;
    max-width: none !important;
    max-inline-size: none !important;
    flex-basis: 100% !important;
  }

  .vfa-auth-root .card {
    width: 100%;
    max-width: none;
  }

  .vfa-auth-root .card-body {
    padding: 1.5rem;
  }

  .vfa-auth-root .d-flex.justify-content-between {
    align-items: flex-start !important;
  }

  /* Keep the Remember me option and Forgot password link clean and readable
   * on narrow screens without awkward two-line wrapping. */
  .vfa-auth-root .vfa-login-options {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center !important;
    column-gap: .75rem !important;
  }

  .vfa-auth-root .vfa-login-options .form-check {
    margin-inline-start: 0 !important;
  }

  .vfa-auth-root .vfa-login-options .form-check-label,
  .vfa-auth-root .vfa-login-options > a {
    white-space: nowrap;
    font-size: .8125rem !important;
    line-height: 1.25rem;
  }

  .vfa-auth-root .vfa-login-options > a {
    justify-self: end;
    text-align: right;
  }
}

.vfa-auth-root .vfa-code-input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: .5rem;
  font-variant-numeric: tabular-nums;
}


.vfa-auth-root #vfa-register-form .form-check-label {
  line-height: 1.45;
}


/* -------------------------------------------------------------------------
 * Classroom selector
 * ---------------------------------------------------------------------- */
.vfa-auth-root .vfa-classroom-picker {
  position: relative;
  width: 100%;
}

/* Native fallback before JS enhancement. */
.vfa-auth-root .vfa-classroom-picker > select.form-select {
  width: 100%;
  min-height: 38px;
}

.vfa-auth-root .vfa-classroom-custom {
  position: relative;
  width: 100%;
  z-index: 1;
}

.vfa-auth-root .vfa-classroom-custom.is-open {
  z-index: 120;
}

.vfa-auth-root .vfa-classroom-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

.vfa-auth-root .vfa-classroom-trigger {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border: 1px solid var(--bs-border-color, #dbdade);
  border-radius: .375rem;
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #6d6a7b);
  padding: .42rem .72rem;
  font: inherit;
  font-size: .9375rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  outline: 0;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.vfa-auth-root .vfa-classroom-trigger:hover {
  border-color: rgba(115, 103, 240, .48);
}

.vfa-auth-root .vfa-classroom-trigger:focus-visible,
.vfa-auth-root .vfa-classroom-custom.is-open .vfa-classroom-trigger {
  border-color: var(--bs-primary, #7367f0);
  box-shadow: 0 0 0 .2rem rgba(115, 103, 240, .14);
}

.vfa-auth-root .vfa-classroom-trigger.is-invalid {
  border-color: var(--bs-danger, #ff4c51);
}

.vfa-auth-root .vfa-classroom-trigger-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: .7rem;
}

.vfa-auth-root .vfa-classroom-trigger-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-body-color, #6d6a7b);
}

.vfa-auth-root .vfa-classroom-trigger-icon i {
  font-size: 1.1rem;
  line-height: 1;
}

.vfa-auth-root .vfa-classroom-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vfa-auth-root .vfa-classroom-value.is-placeholder {
  color: var(--bs-secondary-color, #a5a3ae);
}

.vfa-auth-root .vfa-classroom-chevron {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-secondary-color, #6d6a7b);
  transition: transform .18s ease;
}

.vfa-auth-root .vfa-classroom-chevron svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.vfa-auth-root .vfa-classroom-custom.is-open .vfa-classroom-chevron {
  transform: rotate(180deg);
}

.vfa-auth-root .vfa-classroom-menu {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  right: 0;
  z-index: 130;
  max-height: min(17.5rem, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .375rem;
  border: 1px solid var(--bs-border-color, #dbdade);
  border-radius: .625rem;
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 .75rem 2rem rgba(34, 32, 44, .16);
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 107, 123, .35) transparent;
}

.vfa-auth-root .vfa-classroom-menu[hidden] {
  display: none !important;
}

.vfa-auth-root .vfa-classroom-option {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: .65rem;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  color: var(--bs-body-color, #6d6a7b);
  padding: .55rem .7rem;
  font: inherit;
  font-size: .9rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  outline: 0;
  transition: background-color .12s ease, color .12s ease;
}

.vfa-auth-root .vfa-classroom-option:hover,
.vfa-auth-root .vfa-classroom-option:focus-visible {
  background: rgba(115, 103, 240, .08);
  color: var(--bs-heading-color, #444050);
}

.vfa-auth-root .vfa-classroom-option.is-selected {
  background: rgba(115, 103, 240, .11);
  color: var(--bs-primary, #7367f0);
  font-weight: 600;
}

.vfa-auth-root .vfa-classroom-option.is-selected::after {
  content: "✓";
  margin-inline-start: auto;
  padding-inline-start: .75rem;
  font-weight: 700;
}

@media (max-width: 575.98px) {
  .vfa-auth-root .vfa-classroom-menu {
    max-height: min(15rem, 38vh);
  }

  .vfa-auth-root .vfa-classroom-option {
    min-height: 42px;
  }
}

/* -------------------------------------------------------------------------
 * Site-wide Login / Register popups
 * ---------------------------------------------------------------------- */
body.vfa-modal-open {
  overflow: hidden !important;
}

.vfa-popup-layer {
  position: relative;
  z-index: 2147483000;
}

.vfa-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(34, 32, 44, .52);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.vfa-modal.is-open {
  display: flex;
}

.vfa-modal-dialog {
  position: relative;
  width: min(100%, 500px);
  max-height: calc(100dvh - 3rem);
  overflow: auto;
  border-radius: .75rem;
  box-shadow: 0 1.25rem 4rem rgba(34, 32, 44, .24);
  -webkit-overflow-scrolling: touch;
}

.vfa-modal-dialog-register {
  width: min(100%, 860px);
}

.vfa-popup-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2rem;
  align-items: center;
  column-gap: .75rem;
  margin-bottom: .25rem;
}

.vfa-popup-title-row > h4 {
  min-width: 0;
  margin: 0 !important;
}

.vfa-modal-close {
  position: static;
  justify-self: end;
  align-self: center;
  display: block;
  width: 2rem;
  height: 2rem;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid var(--bs-border-color, #dbdade) !important;
  border-radius: .375rem;
  background: var(--bs-body-bg, #fff) !important;
  color: var(--bs-body-color, #6d6a7b);
  font-size: 0 !important;
  line-height: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transform: none !important;
  transition: background-color .15s ease, color .15s ease;
}

.vfa-modal-close::before,
.vfa-modal-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.vfa-modal-close {
  position: relative;
}

.vfa-modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.vfa-modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.vfa-modal-close:hover {
  background: rgba(110, 107, 123, .10) !important;
  color: var(--bs-heading-color, #444050);
}

.vfa-modal-close:active {
  background: rgba(110, 107, 123, .16) !important;
  transform: none !important;
}

.vfa-modal-close:focus {
  outline: 0 !important;
}

.vfa-modal-close:focus-visible {
  outline: 0 !important;
  box-shadow: 0 0 0 2px rgba(115, 103, 240, .28) !important;
}


/* The verification title can wrap in the compact desktop modal. Keep the close
 * button aligned with the first title line on larger screens as well. */
@media (min-width: 576px) {
  .vfa-popup-title-row-verification {
    align-items: start;
  }

  .vfa-popup-title-row-verification .vfa-modal-close {
    align-self: start;
    margin-top: 6px !important;
  }
}

/* Neutralize page-layout spacing because the auth root now lives inside a
 * fixed dialog instead of taking over the content area. */
.vfa-modal .vfa-auth-root,
.vfa-modal .vfa-auth-root .authentication-wrapper,
.vfa-modal .vfa-auth-root .authentication-inner {
  width: 100% !important;
  min-height: 0 !important;
  max-width: none !important;
  max-inline-size: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Vuexy's fixed-navbar layout applies padding-block-start/end to .container-p-y
 * with a more specific !important selector. Override that exact combination
 * inside our popup so no extra strip appears above/below the auth card. */
.vfa-modal .vfa-auth-root .authentication-wrapper.authentication-basic.container-p-y {
  padding-block-start: 0 !important;
  padding-block-end: 0 !important;
}

.vfa-modal .vfa-auth-root,
.vfa-modal .vfa-auth-root .authentication-wrapper {
  display: block !important;
}

.vfa-modal .vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner::before,
.vfa-modal .vfa-auth-root .authentication-wrapper.authentication-basic .authentication-inner::after {
  display: none !important;
}

.vfa-modal .vfa-auth-root .card {
  margin: 0 !important;
  border-radius: .75rem;
  box-shadow: none;
}

.vfa-modal .vfa-auth-root .card-body {
  padding: 1.5rem 2rem 2rem;
}

/* On normal pages we intentionally do not load the plugin's full Vuexy CSS.
 * These small fallbacks keep the dialog functional even if a theme omits a
 * few Bootstrap utility rules; on Mathematics.cy the theme's own styles win. */
.vfa-modal .d-grid { display: grid; }
.vfa-modal .w-100 { width: 100%; }
.vfa-modal .text-center { text-align: center; }
.vfa-modal .row { display: flex; flex-wrap: wrap; }
.vfa-modal .col-12 { width: 100%; }
.vfa-modal .form-control,
.vfa-modal .form-select,
.vfa-modal .input-group { width: 100%; box-sizing: border-box; }
.vfa-modal .input-group { display: flex; }
.vfa-modal .input-group .form-control,
.vfa-modal .input-group .form-select { min-width: 0; flex: 1 1 auto; }
.vfa-modal .input-group-text { display: inline-flex; align-items: center; justify-content: center; }

@media (min-width: 576px) {
  .vfa-modal .col-sm-6 { width: 50%; }
}

@media (min-width: 768px) {
  .vfa-modal .col-md-6 { width: 50%; }
}

@media (max-width: 575.98px) {
  .vfa-modal {
    align-items: center;
    padding: .75rem;
  }

  .vfa-modal-dialog {
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    border-radius: .75rem;
  }

  .vfa-modal .vfa-auth-root.container-xxl,
  .vfa-modal .vfa-auth-root .authentication-wrapper.authentication-basic.container-p-y,
  .vfa-modal .vfa-auth-root .authentication-inner.py-6 {
    padding: 0 !important;
  }

  .vfa-modal .vfa-auth-root .card-body {
    padding: 1.5rem;
  }

  /* Keep the close button aligned with the first line when a long title wraps. */
  .vfa-popup-title-row {
    align-items: start;
  }

  .vfa-modal-close {
    align-self: start;
    /* Visually center the 2rem close control on the title's first text line. */
    margin-top: 6px !important;
  }
}
