/* ============================================================
   Mock - staff login (staff-login.html). Plain CSS on top of
   landing.css (tokens, .btn, .field-input, .spinner, .contours).
   ============================================================ */

.hidden { display: none !important; }

/* ---------- Page: emerald + gold contours ---------- */
.sl {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--emerald);
  isolation: isolate;
}
.sl .contours { position: fixed; }

.sl-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 48px var(--gutter) 40px;
}
@media (min-height: 820px) {
  .sl-main { justify-content: center; }
}

.sl-brand { margin-bottom: 24px; text-align: center; }
.sl-logo { display: inline-flex; border-radius: 6px; }
.sl-logo img { height: 40px; width: auto; }
.sl-logo:focus-visible { outline-color: var(--gold); }
.sl-portal {
  margin: 6px 0 0;
  color: var(--sage);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ---------- Card ---------- */
.sl-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 0;
  border-top: 3px solid var(--gold);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.12);
}
@media (max-width: 480px) {
  .sl-card { padding: 28px 20px 0; }
}

/* Create account (Panel 3) on wide screens: the card widens to 720px and the
   four fields sit in two columns (name | email, password | confirm). The
   sign-in panels keep the narrow card. :has() follows the panel however it
   is shown (showMode, init(), or a direct class toggle). */
@media (min-width: 900px) {
  .sl-card { transition: max-width 0.3s ease; }
  .sl-card:has(> #signup-mode:not(.hidden)) { max-width: 720px; }
  #signup-mode .sl-title { white-space: nowrap; }
  #signup-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
  }
  #signup-form > :not(.sl-field) { grid-column: 1 / -1; }
  #signup-form .sl-rules { display: flex; flex-wrap: wrap; gap: 8px 24px; }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
  .sl-card { transition: none; }
}

/* Panel switch: a short fade-in whenever a panel or step is shown. */
.sl-panel:not(.hidden),
.sl-step:not(.hidden) { animation: sl-in 0.22s ease-out; }
@keyframes sl-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sl-panel:not(.hidden),
  .sl-step:not(.hidden) { animation: none; }
}

.sl-title {
  margin: 0;
  color: var(--charcoal);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.15;
  text-align: center;
}
.sl-title:focus { outline: none; }
.sl-sub {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.sl-center .sl-sub b { color: var(--charcoal); overflow-wrap: anywhere; }

.sl-full { width: 100%; }

.sl-google {
  width: 100%;
  background: var(--white);
  color: var(--charcoal);
  border: 1px solid #D1D5DB;
}
.sl-google:hover { background: #F9FAFB; border-color: #9CA3AF; }
.sl-google svg { width: 20px; height: 20px; flex: none; }
.btn:disabled { opacity: 0.7; cursor: wait; }

.sl-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}
.sl-or::before,
.sl-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.sl-switch {
  margin: 24px 0 0;
  color: var(--text);
  font-size: 14px;
  text-align: center;
}
.sl-switch a { color: var(--charcoal); font-weight: 600; text-underline-offset: 3px; }

/* ---------- Fields ---------- */
.sl-field { margin-bottom: 16px; }
.sl-pw { position: relative; }
.sl-pw .field-input { padding-right: 52px; }
.sl-eye {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sl-eye:hover { color: var(--charcoal); }
.sl-eye svg { width: 20px; height: 20px; }

/* Email for password managers; visually hidden. */
.sl-username {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  padding: 0;
  opacity: 0;
}

.sl-back {
  display: inline-block;
  margin: -8px 0 16px -6px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.sl-back:hover { color: var(--charcoal); text-decoration: underline; text-underline-offset: 3px; }
#email-panel .sl-title { margin-bottom: 24px; }

.sl-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: #F3F4F6;
  color: var(--charcoal);
  font-size: 14px;
}
.sl-chip span { overflow-wrap: anywhere; }

.sl-link {
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--charcoal);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.sl-link:disabled { opacity: 0.7; cursor: wait; }
.sl-forgot-row { margin-top: 16px; text-align: center; }

/* Password rules checklist */
.sl-rules {
  display: grid;
  gap: 6px;
  margin: -4px 0 16px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
}
.sl-rules li { display: flex; align-items: center; gap: 8px; }
.sl-tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid #D1D5DB;
  border-radius: 50%;
}
.sl-rules li.is-met { color: #166534; }
.sl-rules li.is-met .sl-tick { border-color: #15803D; background: #15803D; }
.sl-rules li.is-met .sl-tick::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 2px solid #FFFFFF;
  border-bottom: 2px solid #FFFFFF;
  transform: rotate(-45deg);
}

/* Messages: shown/hidden with style.display by the page script. */
.sl-error,
.sl-notice {
  display: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  line-height: 1.45;
}
.sl-error { border: 1px solid #FECACA; background: #FEF2F2; color: var(--error); }
.sl-notice { margin: 16px 0 0; border: 1px solid #BBF7D0; background: #F0FDF4; color: #166534; }
/* "Incorrect email or password." + the two ways out (showCredentialError) */
.sl-error-help { display: grid; gap: 4px; margin-top: 8px; color: var(--text); }
.sl-error-line a { color: var(--charcoal); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Spinner inside gold buttons (landing.css's spinner is white) */
.btn-gold .spinner { border-color: rgba(17, 24, 39, 0.25); border-top-color: var(--charcoal); }

.sl-card-foot {
  margin: 28px -32px 0;
  padding: 16px 32px;
  border-top: 1px solid var(--line);
  text-align: center;
}
@media (max-width: 480px) {
  .sl-card-foot { margin: 24px -20px 0; padding: 16px 20px; }
}
.sl-card-foot a {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.sl-card-foot a:hover { color: var(--charcoal); text-decoration: underline; text-underline-offset: 3px; }

.sl-student {
  margin: 20px 0 0;
  color: var(--sage);
  font-size: 14px;
  text-align: center;
}
.sl-student a { color: var(--cream); font-weight: 600; text-underline-offset: 3px; }
.sl-student a:focus-visible { outline-color: var(--gold); }

/* ---------- Toasts (firebase-config.js showToast builds them with
   Tailwind class names; plain-CSS equivalents for this page) ---------- */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
}
#toast-container > div {
  padding: 12px 20px;
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
#toast-container .bg-green-600 { background: #16A34A; }
#toast-container .bg-red-600 { background: #DC2626; }
#toast-container .bg-yellow-500 { background: #EAB308; color: var(--charcoal); }
#toast-container .bg-gray-800 { background: #1F2937; }
#toast-container .translate-x-full { transform: translateX(calc(100% + 24px)); }
#toast-container .opacity-0 { opacity: 0; }
