/* Studio portal — shared look for the sign-in screens of the teacher app
   (/teacher/app/*) and the admin dashboard (/admin/*). Mirrors the public
   website's palette and type (website/assets/styles.css) so moving from
   symphoniquemusic.com into a portal feels like one product. */

:root {
  --cream: #F8F5ED;
  --surface: #FFFFFF;
  --plum-900: #2F1E3A;
  --plum-700: #382743;
  --plum-500: #4B3159;
  --muted: #58505F;
  --gold: #B08A3E;
  --gold-lt: #CBA75C;
  --gold-ink: #7F6020;
  --line: rgba(38, 25, 47, 0.13);
  --line-strong: rgba(38, 25, 47, 0.26);
  --danger: #A42A1E;
  --danger-bg: #FBEAE7;
  --ok: #1F6B4F;
  --ok-bg: #E4F3EC;
  --warn-ink: #7A4A06;
  --warn-bg: #FBF0D9;
  --radius: 18px;
  --shadow: 0 18px 44px rgba(38, 25, 47, 0.10);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body.portal {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--plum-900);
  font-family: 'Work Sans', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Top strip: way back to the website ---------- */

.portal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px max(20px, 4vw);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--plum-700);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}
.back-link svg { width: 16px; height: 16px; flex: none; }
.back-link:hover { color: var(--gold-ink); }
.back-link:hover span { text-decoration: underline; text-underline-offset: 3px; }

.portal-top .switch { font-size: 0.88rem; color: var(--muted); }
.portal-top .switch a { color: var(--plum-700); font-weight: 500; }

/* ---------- Main card ---------- */

.portal-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px max(16px, 4vw) 40px;
}

.portal-card {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 5fr 6fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.portal-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 44px 40px;
  background: var(--plum-900);
  color: #F4EFE6;
}
.portal-aside::after {
  /* faint gold staff lines, echoing the logo */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 120px;
  background: repeating-linear-gradient(
    to bottom, transparent 0 13px, rgba(203, 167, 92, 0.16) 13px 14px
  );
  -webkit-mask-image: linear-gradient(to top, #000, transparent);
          mask-image: linear-gradient(to top, #000, transparent);
  pointer-events: none;
}
.portal-aside .logo { width: 240px; max-width: 100%; height: auto; display: block; }
.portal-aside .eyebrow {
  margin: 0 0 10px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-lt);
}
.portal-aside h2 {
  margin: 0 0 10px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #F8F5ED;
}
.portal-aside p { margin: 0; color: #CFC5D6; font-size: 0.95rem; }
.portal-aside ul { margin: 14px 0 0; padding: 0; list-style: none; position: relative; z-index: 1; }
.portal-aside li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  color: #E6DEEA;
  font-size: 0.93rem;
}
.portal-aside li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-lt);
  transform: translateY(-2px);
}

.portal-form { padding: 44px 44px 36px; }

.portal-form h1 {
  margin: 0 0 6px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.85rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--plum-900);
}
.portal-form .lead { margin: 0 0 22px; color: var(--muted); }
.portal-form h1 + form,
.portal-form h1 + .notice { margin-top: 22px; }

/* ---------- Notices ---------- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.notice:empty { display: none; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-error { background: var(--danger-bg); color: var(--danger); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice a { color: inherit; font-weight: 600; }

/* ---------- Fields ---------- */

.field { margin: 0 0 16px; }

.field-label, .field label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--plum-700);
}

.portal input[type="text"],
.portal input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 16px; /* no iOS zoom-on-focus */
  color: var(--plum-900);
  transition: border-color .15s, box-shadow .15s;
}
.portal input:focus {
  outline: none;
  border-color: var(--plum-500);
  box-shadow: 0 0 0 3px rgba(75, 49, 89, 0.18);
}
.portal input.code { letter-spacing: 0.35em; font-variant-numeric: tabular-nums; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--plum-500);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.pw-toggle:hover { background: rgba(75, 49, 89, 0.08); }
.pw-toggle:focus-visible { outline: 2px solid var(--plum-500); }

.hint { margin: -8px 0 16px; font-size: 0.84rem; color: var(--muted); }

/* ---------- Buttons ---------- */

.portal .btn,
.portal button[type="submit"]:not(.pw-toggle):not(.text-btn) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  background: var(--plum-700);
  color: #F8F5ED;
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: background .16s, transform .16s;
}
.portal .btn:hover,
.portal button[type="submit"]:not(.pw-toggle):not(.text-btn):hover {
  background: color-mix(in srgb, var(--plum-700) 86%, black);
  transform: translateY(-1px);
}
.portal button[disabled] { opacity: .7; cursor: progress; transform: none; }

.text-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--plum-700);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.form-error { margin: 0 0 14px; color: var(--danger); font-size: 0.9rem; }
.form-error:empty { display: none; }
.saved { margin: 0 0 14px; color: var(--ok); font-size: 0.9rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* The teacher password form is shared with the in-app tab, so it arrives
   with the app's own classes — flatten them here. */
.portal-form form.card { margin: 0; padding: 0; border: none; box-shadow: none; background: none; }
.portal-form form.card .field-label { margin-top: 14px; }
.portal-form form.card .field-label:first-of-type { margin-top: 0; }
.portal-form form.card .muted.small { margin: 6px 0 0; }
.portal-form form.card .btn { margin-top: 18px; }

/* ---------- Footer row under the form ---------- */

.form-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 0.88rem;
  color: var(--muted);
}
.form-foot a { color: var(--plum-700); font-weight: 500; }
.form-foot form { margin: 0; }

/* ---------- MFA enrollment ---------- */

.qr {
  display: block;
  width: 184px;
  height: 184px;
  margin: 0 0 14px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.manual { margin: 0 0 18px; font-size: 0.9rem; }
.manual summary { cursor: pointer; color: var(--plum-700); font-weight: 500; }
.manual code {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--cream);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

/* ---------- Small screens: stack, slim the brand panel ---------- */

@media (max-width: 760px) {
  .portal-top { padding: 8px 16px; }
  .portal-top .switch { display: none; }
  .portal-main { align-items: flex-start; padding: 0 12px 28px; }
  .portal-card { grid-template-columns: 1fr; border-radius: 16px; }
  .portal-aside {
    flex-direction: row;
    justify-content: space-between;
    padding: 18px 22px;
    gap: 16px;
  }
  .portal-aside::after { display: none; }
  .portal-aside .logo { width: 116px; }
  .portal-aside .eyebrow { margin: 0; text-align: right; }
  .portal-form { padding: 26px 22px 24px; }
  .portal-form h1 { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
