/**
 * Auth pages — login, signup, password reset, 2FA challenge, etc.
 * Uses system light/dark backdrop images + glass card UI.
 */

/* ---- Backdrop ---- */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--color-bg);
  background-image:
    linear-gradient(to bottom, rgb(241 245 249 / 84%) 0%, rgb(255 255 255 / 94%) 100%),
    url('../img/opt/lightmode-bg-md.jpg');
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

html[data-theme='dark'] .auth-backdrop {
  background-image:
    linear-gradient(to bottom, rgb(15 23 42 / 68%) 0%, rgb(15 23 42 / 82%) 100%),
    url('../img/opt/darkmode-bg-md.jpg');
}

@media (min-width: 769px) {
  .auth-backdrop {
    background-image:
      linear-gradient(to bottom, rgb(241 245 249 / 84%) 0%, rgb(255 255 255 / 94%) 100%),
      url('../img/opt/lightmode-bg.jpg');
  }

  html[data-theme='dark'] .auth-backdrop {
    background-image:
      linear-gradient(to bottom, rgb(15 23 42 / 68%) 0%, rgb(15 23 42 / 82%) 100%),
      url('../img/opt/darkmode-bg.jpg');
  }
}

@media (max-width: 768px) {
  .auth-backdrop {
    background-attachment: scroll;
  }
}

/* ---- Page shell ---- */
.auth-body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: transparent;
  color: var(--color-text);
}

.auth-toolbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: .85rem 1.25rem;
  pointer-events: none;
}

.auth-toolbar > * {
  pointer-events: auto;
}

.auth-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .42rem .75rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  color: var(--color-text-muted);
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.auth-toolbar-btn:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
  text-decoration: none;
}

.auth-toolbar-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .auth-page {
    flex-direction: row;
  }
}

.auth-page--solo,
.auth-page:not(:has(.auth-left)) {
  align-items: center;
  justify-content: center;
  padding: 5rem 1.25rem 2rem;
}

.auth-page--solo .auth-right,
.auth-page:not(:has(.auth-left)) .auth-right {
  width: 100%;
  max-width: 520px;
  padding: 0;
}

/* ---- Promo panel (left) ---- */
.auth-left {
  display: none;
  flex: 1;
  min-height: 100vh;
  padding: 5rem 3rem 3rem;
  position: relative;
  overflow: hidden;
  align-items: center;
}

@media (min-width: 768px) {
  .auth-left {
    display: flex;
  }
}

.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgb(13 71 161 / 82%) 0%, rgb(21 101 192 / 72%) 48%, rgb(10 61 143 / 88%) 100%);
  backdrop-filter: blur(2px);
}

html[data-theme='dark'] .auth-left::before {
  background:
    linear-gradient(135deg, rgb(15 23 42 / 88%) 0%, rgb(30 58 95 / 78%) 50%, rgb(15 23 42 / 92%) 100%);
}

.auth-left::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .35;
  background:
    radial-gradient(circle at 18% 22%, rgb(66 165 245 / 45%) 0%, transparent 42%),
    radial-gradient(circle at 82% 78%, rgb(21 101 192 / 35%) 0%, transparent 45%);
}

.auth-left-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.auth-brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 2rem;
}

.auth-brand-mark .part1 { color: #fff; }
.auth-brand-mark .part2 { color: #93c5fd; }

html[data-theme='dark'] .auth-brand-mark .part2 {
  color: #60a5fa;
}

.auth-left h2 {
  font-size: clamp(1.75rem, 3vw, 2.15rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -.02em;
}

.auth-left h2 em {
  color: #bfdbfe;
  font-style: normal;
}

.auth-left p {
  color: rgb(255 255 255 / 72%);
  font-size: .95rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  color: rgb(255 255 255 / 82%);
  font-size: .875rem;
  line-height: 1.45;
}

.auth-feature::before {
  content: '';
  width: 7px;
  height: 7px;
  margin-top: .45rem;
  border-radius: 50%;
  background: #93c5fd;
  box-shadow: 0 0 0 3px rgb(147 197 253 / 22%);
  flex-shrink: 0;
}

/* ---- Form panel (right) ---- */
.auth-right {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.25rem 2rem;
  position: relative;
}

@media (min-width: 768px) {
  .auth-right {
    width: min(480px, 42vw);
    flex-shrink: 0;
    padding: 5rem 2rem 2rem;
  }
}

@media (min-width: 1100px) {
  .auth-right {
    width: 520px;
  }
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.65rem 1.5rem;
  box-shadow: var(--shadow-lg);
}

html[data-theme='dark'] .auth-card {
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  border-color: color-mix(in srgb, var(--color-border) 65%, transparent);
  box-shadow: 0 16px 48px rgb(0 0 0 / 35%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-card--wide {
  max-width: 520px;
}

.auth-card--center {
  text-align: center;
}

.auth-card-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: .35rem;
  letter-spacing: -.02em;
}

.auth-card-subtitle {
  color: var(--color-text-muted);
  font-size: .9rem;
  line-height: 1.5;
}

.auth-card-subtitle a {
  color: var(--color-primary);
  font-weight: 600;
}

.auth-card-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: .35rem;
}

/* ---- SSO / options ---- */
.auth-access-options {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin: 1.15rem 0 1.1rem;
}

.auth-option-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  padding: .72rem .9rem;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.auth-option-btn:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}

.auth-option-google {
  background: var(--color-surface);
}

.auth-option-demo {
  background: color-mix(in srgb, var(--color-surface-2) 70%, transparent);
}

.auth-option-phone {
  color: var(--color-text);
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .45rem .65rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
}

.auth-option-phone:hover {
  background: var(--green-dim);
  color: var(--color-primary);
  text-decoration: none;
}

.auth-phone-card {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface-2) 55%, transparent);
  padding: 1rem;
  margin-bottom: 1rem;
}

.auth-phone-card h3 {
  margin: 0 0 .35rem;
  color: var(--color-text);
  font-size: 1rem;
}

.auth-phone-card p {
  margin: 0 0 .75rem;
  color: var(--color-text-muted);
  font-size: .82rem;
}

.auth-phone-form + .auth-phone-form {
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--color-border-light);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--color-text-light);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: .2rem 0 1rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-light);
}

/* ---- Form ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form .form-label {
  color: var(--color-text);
  font-weight: 600;
  font-size: .84rem;
}

.auth-form .form-control {
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-surface-2));
  border-color: var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-md);
  padding: .68rem .9rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.auth-form .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--green-dim);
  background: var(--color-surface);
}

.auth-form .input-suffix {
  background: var(--color-surface-2);
  border-color: var(--color-border);
  border-left: none;
  color: var(--color-text-muted);
}

.auth-form .btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  font-weight: 700;
  padding: .78rem;
  font-size: .95rem;
  border-radius: var(--radius-md);
  margin-top: .15rem;
}

.auth-form .btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}

.auth-form .form-control--otp {
  font-size: 1.35rem;
  letter-spacing: .35rem;
  text-align: center;
}

.auth-links {
  text-align: center;
  margin-top: 1rem;
  font-size: .88rem;
  color: var(--color-text-muted);
}

.auth-links a {
  color: var(--color-primary);
  font-weight: 600;
}

.auth-quick-links {
  margin-top: 1.1rem;
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .82rem;
  flex-wrap: wrap;
}

.auth-quick-links a {
  color: var(--color-text-muted);
}

.auth-quick-links a:hover {
  color: var(--color-text);
}

.auth-footer {
  text-align: center;
  margin-top: 1.35rem;
  font-size: .78rem;
  color: var(--color-text-light);
}

.auth-footer a {
  color: var(--color-primary);
  font-weight: 600;
}

.auth-check {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
}

.auth-check input {
  margin-top: .25rem;
  accent-color: var(--color-primary);
}

.auth-check label {
  font-size: .86rem;
  color: var(--color-text-muted);
  font-weight: 400;
  line-height: 1.45;
}

.auth-steps {
  text-align: left;
  font-size: .88rem;
}

.auth-steps ul {
  margin: .5rem 0 0 1.1rem;
  color: var(--color-text-muted);
  list-style: disc;
}

.auth-steps li + li {
  margin-top: .35rem;
}

/* Public enquiry (admissions) on auth layout */
.enq-wrap {
  max-width: 640px;
  margin: 5rem auto 2rem;
  padding: 0 1.25rem;
  width: 100%;
}

.enq-card {
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border) 75%, transparent);
  border-radius: var(--radius-xl);
  padding: 1.65rem 1.5rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.enq-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: .25rem;
  color: var(--color-text);
}

.enq-sub {
  color: var(--color-text-muted);
  font-size: .9rem;
  margin-bottom: 1.2rem;
}

.enq-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .25rem;
  color: var(--color-text);
}

.enq-wrap .auth-form .btn-primary,
.enq-wrap form .btn-primary {
  width: 100%;
}

.enq-foot {
  text-align: center;
  margin-top: .85rem;
  font-size: .82rem;
}

/* Legacy aliases */
.auth-bg { display: contents; }
.auth-logo { display: none; }
.auth-title { font-size: 1.5rem; font-weight: 700; color: var(--color-text); }
.auth-subtitle { color: var(--color-text-muted); font-size: .9rem; }

@media (max-width: 767px) {
  .auth-toolbar {
    padding: .65rem 1rem;
  }

  .auth-right {
    padding-top: 4.5rem;
  }

  .auth-card {
    padding: 1.35rem 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-option-btn:hover {
    transform: none;
  }
}
