*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  position: relative;
  overflow-y: auto;
  background: linear-gradient(135deg, rgba(11,35,24,0.68) 0%, rgba(11,35,24,0.53) 50%),
    url('/assets/img/LOGIN_BG.png') center center / cover no-repeat fixed;
  padding: 40px 16px;
}

/* ── Card ──────────────────────────────────────────────────── */
.auth-card,
.card,
.register-card {
  background: #ffffff;
  border: 1.5px solid #e8f0eb;
  border-radius: 28px;
  padding: 44px 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  animation: card-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Brand ─────────────────────────────────────────────────── */
.brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo {
  width: 80px;
  height: auto;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo:hover {
  transform: scale(1.08) rotate(-2deg);
}

.brand p {
  font-size: 0.875rem;
  color: #7a9e8a;
  margin-top: 8px;
  font-weight: 500;
}

/* ── Step indicators ───────────────────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  border: 2px solid #d4e8dc;
  color: #9aab9d;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-label {
  font-size: 0.67rem;
  color: #9aab9d;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.step.active .step-num {
  background: #c9973a;
  border-color: transparent;
  color: #0b2318;
  box-shadow: 0 0 0 4px rgba(201, 151, 58, 0.2);
  transform: scale(1.1);
}

.step.active .step-label {
  color: #c9973a;
  font-weight: 700;
}

.step.done .step-num {
  background: rgba(29, 90, 62, 0.1);
  border-color: #1d5a3e;
  color: #1d5a3e;
}

.step.done .step-label {
  color: #1d5a3e;
}

.step-line {
  flex: 1;
  height: 2px;
  background: #d4e8dc;
  margin: 0 10px 20px;
  border-radius: 2px;
  transition: background 0.4s ease;
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Form groups ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 0.72rem;
  color: #4a7a5e;
  margin-bottom: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.input-wrap {
  position: relative;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  background: #f7faf8;
  border: 1.5px solid #d4e8dc;
  border-radius: 12px;
  color: #0b2318;
  font-size: 0.9375rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input::placeholder {
  color: #9aab9d;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #1d5a3e;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(29, 90, 62, 0.1);
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a9e8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.form-group input[type="password"] {
  padding-right: 48px;
}

/* ── Password toggle ───────────────────────────────────────── */
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #9aab9d;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  transition: color 0.2s ease, background 0.2s ease;
}

.toggle-pw:hover {
  color: #1d5a3e;
  background: rgba(29, 90, 62, 0.08);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: #c9973a;
  border: none;
  border-radius: 20px;
  color: #0b2318;
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.3px;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s ease,
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease;
}

.btn-primary:hover {
  background: #e8b96a;
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 6px 20px rgba(201, 151, 58, 0.4);
}

.btn-primary:active {
  transform: translateY(0) scale(0.99);
  box-shadow: none;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: transparent;
  border: 1.5px solid #d4e8dc;
  border-radius: 20px;
  color: #4a7a5e;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.3px;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s ease,
              border-color 0.2s ease,
              color 0.2s ease,
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-secondary:hover {
  background: #f0f7f4;
  border-color: #1d5a3e;
  color: #0b2318;
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-row .btn-primary,
.btn-row .btn-secondary {
  flex: 1;
  margin-top: 0;
}

/* ── Form row ──────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  text-align: center;
  margin: 22px 0 16px;
  position: relative;
  color: #9aab9d;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: #d4e8dc;
}

.divider::before { left: 0; }
.divider::after  { right: 0; }

/* ── Switch link ───────────────────────────────────────────── */
.switch-link {
  text-align: center;
  font-size: 0.85rem;
  color: #7a9e8a;
  margin-top: 6px;
}

.switch-link a {
  color: #1d5a3e;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease;
}

.switch-link a:hover {
  color: #c9973a;
  text-decoration: underline;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: alert-in 0.3s ease both;
}

@keyframes alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-error {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border: 1.5px solid #a7f3d0;
  color: #065f46;
}

/* ── Validation ────────────────────────────────────────────── */
.required {
  color: #dc2626;
  margin-left: 2px;
}

.field-error {
  display: block;
  color: #b91c1c;
  font-size: 0.76rem;
  margin-top: 5px;
  font-weight: 500;
}

.input-error {
  border-color: #fca5a5 !important;
  background: #fef2f2 !important;
}

.input-error:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* ── Role select cards ─────────────────────────────────────── */
#card-role-select { max-width: 520px; }

.role-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 8px;
}

.role-select-grid--single {
  grid-template-columns: 1fr;
}

.role-select-card {
  background: #f7faf8;
  border: 1.5px solid #d4e8dc;
  border-radius: 16px;
  padding: 28px 18px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease,
              background 0.2s ease,
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease;
}

.role-select-card:hover {
  border-color: #c9973a;
  background: rgba(201, 151, 58, 0.05);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(11, 35, 24, 0.1);
}

.role-select-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0b2318;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8b96a;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.role-select-card:hover .role-select-avatar {
  transform: scale(1.1);
}

.role-select-card h2 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0b2318;
  margin: 0;
  line-height: 1.3;
}

.role-select-card p {
  font-size: 0.78rem;
  color: #7a9e8a;
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.btn-role-select {
  margin-top: 6px;
  width: 100%;
  padding: 10px 12px;
  background: #c9973a;
  border: none;
  border-radius: 20px;
  color: #0b2318;
  font-size: 0.84rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease,
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-role-select:hover {
  background: #e8b96a;
  transform: translateY(-1px);
}

/* ── Scope badges ──────────────────────────────────────────── */
.badge-scope.school-wide {
  background: rgba(201, 151, 58, 0.12);
  color: #7a5a1a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid rgba(201, 151, 58, 0.3);
}

.badge-scope.course-only {
  background: rgba(29, 90, 62, 0.1);
  color: #1d5a3e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid rgba(29, 90, 62, 0.2);
}

/* ── Misc ──────────────────────────────────────────────────── */
.switch-link--spaced { margin-top: 24px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { padding: 24px 12px; }

  .auth-card,
  .card,
  .register-card {
    padding: 36px 28px;
    max-width: 100%;
  }

  .role-select-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .role-select-card { padding: 24px 16px 20px; }
  .steps { margin-bottom: 24px; }
  .step-label { font-size: 0.65rem; }
  .step-num { width: 32px; height: 32px; font-size: 0.78rem; }
}

@media (max-width: 640px) {
  body { padding: 24px 16px; }

  .auth-card,
  .card,
  .register-card {
    padding: 32px 24px;
    border-radius: 24px;
  }

  .brand-logo { width: 70px; }
  #card-role-select { max-width: 100%; }

  .form-group input,
  .form-group select {
    font-size: 0.875rem;
    padding: 10px 13px;
  }

  .btn-primary,
  .btn-secondary {
    font-size: 0.875rem;
    padding: 11px;
  }

  .btn-row {
    flex-direction: column;
    gap: 8px;
  }

  .form-row { grid-template-columns: 1fr; }

  .role-select-avatar { width: 50px; height: 50px; }
  .role-select-card h2 { font-size: 0.875rem; }
  .role-select-card p  { font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .auth-card,
  .card,
  .register-card {
    padding: 28px 20px;
  }

  .brand-logo { width: 60px; }

  .steps { gap: 8px; }
  .step-num { width: 30px; height: 30px; font-size: 0.75rem; }
  .step-label { font-size: 0.6rem; }
  .step-line { margin: 0 6px 20px; }
  .form-group label { font-size: 0.7rem; }
}

@media (max-width: 400px) {
  body {
    padding: 16px 10px;
    align-items: flex-start;
  }

  .auth-card,
  .card,
  .register-card {
    padding: 24px 16px;
    border-radius: 20px;
    width: 100%;
  }

  .brand { margin-bottom: 20px; }
  .brand-logo { width: 56px; }
  .brand p { font-size: 0.8rem; }

  /* Compress step indicators to fit narrow screens */
  .steps {
    margin-bottom: 20px;
    gap: 0;
  }

  .step-num {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }

  .step-label {
    font-size: 0.55rem;
    letter-spacing: 0.03em;
  }

  .step-line {
    margin: 0 4px 18px;
    flex: 1;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .form-group label {
    font-size: 0.68rem;
    margin-bottom: 5px;
  }

  .form-group input,
  .form-group select {
    font-size: 0.85rem;
    padding: 10px 12px;
    border-radius: 10px;
  }

  .btn-primary,
  .btn-secondary {
    font-size: 0.85rem;
    padding: 11px;
    border-radius: 18px;
  }

  .btn-row {
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .divider { margin: 16px 0 12px; }

  .switch-link { font-size: 0.8rem; }

  .id-upload-notice {
    font-size: 0.75rem;
    padding: 10px 12px;
  }

  .id-upload-zone { min-height: 110px; }

  .id-preview { height: 130px; }
}

/* ── ID Upload ─────────────────────────────────────────────── */
.id-upload-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(29, 90, 62, 0.07);
  border: 1.5px solid rgba(29, 90, 62, 0.18);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.8rem;
  color: #1d5a3e;
  line-height: 1.5;
  margin-bottom: 18px;
}

.id-upload-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.id-upload-zone {
  width: 100%;
  min-height: 130px;
  border: 2px dashed #d4e8dc;
  border-radius: 14px;
  background: #f7faf8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.id-upload-zone:hover {
  border-color: #1d5a3e;
  background: #f0f7f4;
}

.id-upload-zone.zone-drag {
  border-color: #c9973a;
  background: rgba(201, 151, 58, 0.05);
}

.id-upload-zone.zone-error {
  border-color: #fca5a5;
  background: #fef2f2;
}

.id-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: #9aab9d;
  text-align: center;
  pointer-events: none;
}

.id-upload-placeholder span {
  font-size: 0.875rem;
  font-weight: 600;
  color: #4a7a5e;
}

.id-upload-placeholder small {
  font-size: 0.72rem;
  color: #9aab9d;
}

.id-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

/* ── ≤360px fixes ──────────────────────────────────────────── */
@media (max-width: 360px) {
  body { padding: 14px 8px; }

  .auth-card,
  .card,
  .register-card {
    padding: 20px 12px;
    border-radius: 16px;
  }

  .brand { margin-bottom: 18px; }
  .brand-logo { width: 50px; }
  .brand p { font-size: 0.76rem; }

  /* Step indicators — very tight */
  .steps { margin-bottom: 16px; gap: 0; }

  .step-num {
    width: 26px;
    height: 26px;
    font-size: 0.68rem;
  }

  .step-label {
    font-size: 0.5rem;
    letter-spacing: 0.02em;
  }

  .step-line { margin: 0 3px 16px; }

  .form-group { margin-bottom: 10px; }

  .form-group label {
    font-size: 0.64rem;
    margin-bottom: 4px;
  }

  .form-group input,
  .form-group select {
    font-size: 0.82rem;
    padding: 9px 11px;
    border-radius: 9px;
  }

  .btn-primary,
  .btn-secondary {
    font-size: 0.82rem;
    padding: 10px;
    border-radius: 16px;
  }

  .btn-row { gap: 6px; }

  .form-row { grid-template-columns: 1fr; }

  .divider { margin: 14px 0 10px; font-size: 0.72rem; }
  .switch-link { font-size: 0.76rem; }

  /* ID upload */
  .id-upload-notice { font-size: 0.72rem; padding: 9px 10px; }
  .id-upload-zone   { min-height: 96px; }
  .id-preview       { height: 110px; }

  /* Role select cards */
  .role-select-card { padding: 18px 12px 16px; border-radius: 12px; }
  .role-select-avatar { width: 44px; height: 44px; }
  .role-select-card h2 { font-size: 0.82rem; }
  .role-select-card p  { font-size: 0.72rem; }
  .btn-role-select { font-size: 0.78rem; padding: 8px 10px; }
}
