@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

.auth-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  padding: 32px 20px;
  background:
    linear-gradient(135deg, transparent 0 63%, rgba(0, 173, 181, .08) 63% 64%, transparent 64%),
    linear-gradient(45deg, transparent 0 78%, rgba(217, 171, 79, .12) 78% 79%, transparent 79%),
    linear-gradient(145deg, #112a3a 0%, #075a63 58%, #eaf1ed 58%, #f5f7f5 100%);
  color: #1c2931;
  font-family: 'DM Sans', sans-serif;
}

.auth-stage::after {
  position: absolute;
  z-index: -1;
  right: max(5vw, 24px);
  bottom: 32px;
  color: rgba(17, 42, 58, .48);
  content: 'PROGRESS PREPARATORY SCHOOL';
  font: 700 11px 'DM Sans', sans-serif;
  letter-spacing: 1.8px;
}

.auth-stage .portal-login-card,
.auth-stage .student-login-card,
.auth-stage > form,
.auth-reset-card {
  width: min(100%, 450px);
  padding: clamp(26px, 6vw, 42px);
  border: 1px solid rgba(255, 255, 255, .72);
  border-top: 4px solid var(--auth-accent, #00adb5);
  border-radius: 12px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 24px 64px rgba(8, 27, 38, .2);
  color: #1c2931;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  animation: auth-enter .4s ease both;
}

.auth-stage .portal-login-card h1,
.auth-stage .student-login-card h2,
.auth-stage > form h1,
.auth-reset-card h1 {
  margin: 0 0 8px;
  color: #132f40;
  font: 800 25px/1.2 'Manrope', sans-serif;
}

.auth-stage .portal-login-card > p,
.auth-stage .student-login-card > p,
.auth-stage > form > p,
.auth-reset-card p {
  margin: 0 0 22px;
  color: #62727a;
  font: 400 14px/1.65 'DM Sans', sans-serif;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-brand img {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 1px solid #dfe8e5;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.auth-brand div { display: grid; gap: 3px; }
.auth-brand strong { color: #132f40; font: 700 14px/1.3 'Manrope', sans-serif; }
.auth-brand span { color: #718087; font: 500 11px/1.4 'DM Sans', sans-serif; }

.auth-stage label,
.auth-reset-card label {
  display: block;
  margin: 15px 0 7px;
  color: #354a54;
  font: 700 12px/1.4 'DM Sans', sans-serif;
}

.auth-stage input:not([type=checkbox]),
.auth-reset-card input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #d8e2df;
  border-radius: 7px;
  background: #fbfcfb;
  color: #1c2931;
  font: 500 14px 'DM Sans', sans-serif;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.auth-stage input:focus,
.auth-reset-card input:focus {
  outline: none;
  border-color: var(--auth-accent, #00adb5);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent, #00adb5) 16%, transparent);
}

.auth-password-field { display: flex; align-items: center; gap: 8px; width: 100%; }
.auth-password-field input { width: 0 !important; min-width: 0; flex: 1 1 auto; padding-right: 13px !important; }
.auth-password-toggle {
  position: static;
  width: auto;
  min-width: 52px;
  min-height: 46px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid #d8e2df;
  border-radius: 4px;
  background: #fbfcfb;
  color: var(--auth-accent, #008c93);
  font: 700 11px 'DM Sans', sans-serif;
  cursor: pointer;
}
.auth-password-toggle:focus-visible { outline: 2px solid var(--auth-accent, #008c93); outline-offset: 2px; }

.auth-stage button[type=submit],
.auth-reset-card button[type=submit] {
  width: 100%;
  min-height: 46px;
  margin-top: 20px;
  border: 0;
  border-radius: 7px;
  background: var(--auth-accent, #008c93);
  color: #fff;
  font: 700 14px 'DM Sans', sans-serif;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}

.auth-stage button[type=submit]:hover,
.auth-reset-card button[type=submit]:hover {
  filter: brightness(.94);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(19, 47, 64, .16);
}

.auth-stage button[type=submit]:disabled,
.auth-reset-card button[type=submit]:disabled { cursor: wait; opacity: .65; }

.auth-forgot-link {
  display: block;
  width: fit-content;
  margin: 12px 0 0 auto;
  color: var(--auth-accent, #008c93);
  font: 700 12px 'DM Sans', sans-serif;
  text-decoration: none;
}
.auth-forgot-link:hover,
.auth-back-link:hover { text-decoration: underline; }

.auth-stage .portal-login-error,
.auth-stage .student-login-error,
.auth-stage #error,
.auth-reset-card #message {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #b13e34;
  font: 500 12px/1.5 'DM Sans', sans-serif;
}

.auth-back-link {
  display: block;
  margin: 18px 0 0;
  color: #647780;
  font: 600 12px 'DM Sans', sans-serif;
  text-align: center;
  text-decoration: none;
}

.auth-reset-page {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 32px 20px;
  background:
    linear-gradient(135deg, transparent 0 63%, rgba(0, 173, 181, .08) 63% 64%, transparent 64%),
    linear-gradient(145deg, #112a3a 0%, #075a63 58%, #eaf1ed 58%, #f5f7f5 100%);
  color: #1c2931;
  font-family: 'DM Sans', sans-serif;
}

.auth-reset-card { border-top-color: #078d35; }
.auth-reset-card section + section { margin-top: 12px; }
.auth-reset-card a:not(.auth-back-link) {
  display: block;
  margin-top: 11px;
  color: #078d35;
  font: 600 12px 'DM Sans', sans-serif;
  text-align: center;
  text-decoration: none;
}

@keyframes auth-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .auth-stage, .auth-reset-page { padding: 20px 14px 68px; }
  .auth-stage .portal-login-card,
  .auth-stage .student-login-card,
  .auth-stage > form,
  .auth-reset-card { padding: 25px 22px; }
  .auth-brand { margin-bottom: 22px; }
  .auth-stage::after { right: 14px; bottom: 16px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-stage .portal-login-card,
  .auth-stage .student-login-card,
  .auth-stage > form,
  .auth-reset-card { animation: none; }
  .auth-stage input, .auth-reset-card input,
  .auth-stage button[type=submit], .auth-reset-card button[type=submit] { transition: none; }
}
