@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --dark-blue: #0A1C40;
  --blue: #153B75;
  --sky-blue: #4DA6FF;
  --yellow: #FFC700;
  --light-yellow: #FFE066;
  --cream: #F7F5F0;
  --card: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --line: #E2E8F0;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --shadow: 0 18px 50px rgba(10, 28, 64, 0.18);
  --soft-shadow: 0 8px 24px rgba(10, 28, 64, 0.08);
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(10, 28, 64, 0.92), rgba(21, 59, 117, 0.78)),
    url('../images/library.jpg') center/cover fixed;
  color: var(--text-main);
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-shell {
  width: min(980px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 0.92fr 1fr;
  background: var(--card);
  border: 2px solid rgba(255, 199, 0, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: authEnter 0.55s ease both;
}

.auth-shell-wide {
  width: min(1120px, 100%);
  grid-template-columns: 0.82fr 1.18fr;
}

.auth-brand-panel {
  position: relative;
  min-height: 100%;
  padding: 44px 38px;
  background:
    linear-gradient(135deg, rgba(10, 28, 64, 0.96), rgba(21, 59, 117, 0.86)),
    url('../images/classroom.jpg') center/cover;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.auth-brand-panel:after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34px;
  height: 82px;
  background: var(--yellow);
  border: 2px solid rgba(10, 28, 64, 0.45);
  transform: translate(50%, 30%);
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark-blue);
  background: var(--yellow);
  font-size: 28px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  animation: floatMark 4.8s ease-in-out infinite;
}

.auth-brand-panel h2 {
  color: var(--yellow);
  font-size: 30px;
  font-weight: 800;
}

.auth-brand-panel p {
  max-width: 370px;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.65;
  font-size: 14px;
}

.brand-meter {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.brand-meter span {
  height: 6px;
  width: 46px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.brand-meter span:first-child {
  background: var(--yellow);
}

.auth-wrapper {
  width: min(430px, 100%);
  animation: authEnter 0.5s ease both;
}

.auth-card {
  background: var(--card);
  padding: 42px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-wrapper .auth-card {
  border: 2px solid rgba(255, 199, 0, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card-wide {
  padding: 34px 36px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 22px;
  font-weight: 700;
  transition: color 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
  color: var(--blue);
  transform: translateX(-2px);
}

.auth-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.auth-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark-blue);
  margin-bottom: 6px;
}

.auth-step,
.auth-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.auth-pill {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.progress-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.progress-step {
  flex: 1;
  height: 5px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-step.active {
  background: linear-gradient(90deg, var(--yellow), var(--blue));
}

.signup-step-panel {
  display: none;
  animation: stepIn 0.28s ease both;
}

.signup-step-panel.active {
  display: block;
}

.form-group {
  margin-bottom: 15px;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--dark-blue);
  margin-bottom: 7px;
  text-transform: uppercase;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
}

.input-icon img {
  width: 16px;
  height: 16px;
  display: block;
}

.form-input,
.form-select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 13px 11px 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  background: #f8fafc;
  color: var(--text-main);
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-input.no-icon,
.form-select.no-icon {
  padding-left: 13px;
}

.password-input {
  padding-right: 86px;
}

.form-input:focus,
.form-select:focus,
.otp-box:focus {
  outline: none;
  border-color: var(--sky-blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.mi-suffix {
  grid-template-columns: 86px 1fr;
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.radio-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 12px;
  cursor: pointer;
  background: #fff;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.radio-card input {
  display: none;
}

.radio-card span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.radio-card:hover {
  transform: translateY(-1px);
  border-color: var(--sky-blue);
}

.radio-card.active {
  border-color: var(--yellow);
  background: #fffbeb;
  color: var(--dark-blue);
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.year-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  padding: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.year-btn:hover {
  transform: translateY(-1px);
  border-color: var(--sky-blue);
}

.year-btn.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.info-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius);
  background: #eff6ff;
  color: var(--blue);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 700;
  margin-top: 6px;
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.btn-primary,
.btn-secondary {
  min-width: 0;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
  flex: 1;
  padding: 12px 16px;
  background: var(--yellow);
  color: var(--dark-blue);
  border: 1px solid var(--yellow);
  box-shadow: 0 10px 22px rgba(255, 199, 0, 0.24);
}

.btn-primary:hover {
  background: var(--light-yellow);
  transform: translateY(-1px);
}

.btn-secondary {
  flex: 1;
  padding: 12px 16px;
  background: #fff;
  color: var(--blue);
  border: 1px solid #bfdbfe;
}

.btn-secondary:hover {
  background: #eff6ff;
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 20px;
  font-size: 13px;
}

.remember-row,
.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
}

.remember-row input,
.terms-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  margin-top: 2px;
}

.auth-options a,
.auth-switch a,
.terms-row a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
}

.auth-options a:hover,
.auth-switch a:hover {
  color: var(--dark-blue);
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 13px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: #eff6ff;
  color: var(--blue);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.password-strength {
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.strength-weak { background: var(--danger); width: 33%; }
.strength-medium { background: var(--warning); width: 66%; }
.strength-strong { background: var(--success); width: 100%; }

.strength-text {
  font-size: 12px;
  margin-top: 5px;
  color: var(--text-muted);
}

.error-msg {
  display: none;
  color: #dc2626;
  font-size: 12px;
  margin-top: 5px;
}

.lock-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

.otp-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
}

.otp-box {
  width: 45px;
  height: 50px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.auth-loading-overlay { position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; padding:16px; background:rgba(10,28,64,.32); }
body.auth-scroll-locked { position:fixed; inset-inline:0; width:100%; overflow:hidden; overscroll-behavior:none; }
.auth-loading-box { box-sizing:border-box; width:min(225px, calc(100vw - 32px)); min-height:190px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px; border:1px solid #e2e8f0; border-radius:16px; background:#fff; box-shadow:0 18px 50px rgba(15,23,42,.2); color:#1e293b; text-align:center; }
.auth-loading-spinner { width:76px; height:76px; margin:0 0 18px; border:5px solid #dbeafe; border-top-color:#153b75; border-right-color:#4da6ff; border-radius:50%; animation:authSpin .8s linear infinite; }
.auth-loading-box strong { font-size:20px; line-height:1.2; }
.auth-loading-box small { margin-top:7px; color:#64748b; font-size:15px; }

@keyframes authEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

@keyframes authLoadingDismiss {
  to { opacity: 0; visibility: hidden; }
}

@keyframes stepIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes floatMark {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 860px) {
  .auth-shell,
  .auth-shell-wide {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-brand-panel {
    min-height: 230px;
    padding: 30px 26px;
  }

  .auth-card,
  .auth-card-wide {
    padding: 30px 24px;
  }
}

@media (max-width: 560px) {
  .auth-page {
    align-items: flex-start;
    padding: 12px 10px;
  }

  .auth-shell,
  .auth-shell-wide {
    min-height: 0;
    border-width: 1px;
  }

  .auth-brand-panel {
    min-height: 210px;
  }

  .auth-title {
    font-size: 24px;
  }

  .form-grid.two,
  .year-grid {
    grid-template-columns: 1fr;
  }

  .auth-card,
  .auth-card-wide {
    min-width: 0;
    padding: 24px 18px;
  }

  .form-grid.mi-suffix {
    grid-template-columns: 74px 1fr;
  }

  .auth-options,
  .auth-heading-row {
    align-items: flex-start;
  }

  .btn-row {
    flex-direction: column;
  }

  .btn-row > button {
    width: 100%;
  }

  .radio-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-pill {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
