/* Login screen (approved 2026-11-12, sample «א · כרטיס על רקע הפתיחה»).
   The card sits on the opening page's own light scene: while the login is up the
   splash stays visible behind it as a backdrop (its logo, light beam and loading
   line hidden), so after a login the card fades and the opening page simply goes
   on in the same place (app.js showLogin / finishLogin, index.html __mdEntry).
   «מחובר» shows inside the button; short messages sit centred UNDER the button
   in a slot that is always there, so the card never changes size. */

/* ── the backdrop: the opening page, kept visible while the login is up ── */
body.rf #splash.mde-login.splash-paused {
  opacity: 1;
}
body.rf #splash.mde-login.splash-paused :is(.splash-inner, .mde-fx) {
  visibility: hidden;
}
/* the soft lights and the horizon keep moving behind the card */
body.rf #splash.mde-login :is(.mde-aur, .mde-horizon) {
  animation-play-state: running !important;
}
/* the credit at the bottom is the opening page's own, shown from the start */
body.rf #splash.mde-login .splash-credit {
  animation: none;
  opacity: 1;
}
/* in dark the YSTUDIA mark turns light, as it did on the old login */
:root[data-theme="dark"] body.rf #splash.mde-login .splash-ystudia {
  filter: brightness(0) invert(1);
  opacity: 0.78;
}
/* after a login the logo builds again from the start (app.js restartEntrance) */
body.rf #splash.mde-restart .splash-inner * {
  animation: none !important;
}

/* ── the screen ── */
body.rf .login-screen {
  /* fallback when the opening page is not there: the same scene, still */
  background: linear-gradient(180deg, #e7f3f5 0%, #d3e6ea 46%, #e6dfd6 84%, #f3dccb 100%);
  padding: 18px;
}
:root[data-theme="dark"] body.rf .login-screen {
  background: linear-gradient(180deg, #0c121d 0%, #101b28 50%, #171f2c 82%, #241f27 100%);
}
body.rf .login-screen.on-splash,
:root[data-theme="dark"] body.rf .login-screen.on-splash {
  background: transparent;
}
body.rf .login-screen.on-splash .login-credit {
  display: none;
}

/* ── the card ── */
body.rf .login-card {
  --lg-line: rgba(14, 28, 48, 0.13);
  --lg-bad: #b23b35;
  --lg-bad-line: rgba(196, 64, 58, 0.6);
  --lg-bad-halo: rgba(196, 64, 58, 0.1);
  --lg-warn: #9a5320;
  max-width: 372px;
  align-items: stretch;
  padding: 32px 28px 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(14, 28, 48, 0.06);
  box-shadow:
    0 26px 60px -24px rgba(10, 55, 66, 0.34),
    0 3px 10px rgba(10, 55, 66, 0.05);
}
:root[data-theme="dark"] body.rf .login-card {
  --lg-line: var(--border);
  --lg-bad: #f08a80;
  --lg-bad-line: rgba(240, 138, 128, 0.6);
  --lg-bad-halo: rgba(240, 138, 128, 0.14);
  --lg-warn: #f0a46c;
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 26px 60px -24px rgba(0, 0, 0, 0.6);
}
body.rf .login-mark {
  width: 204px;
  max-width: 64%;
  align-self: center;
  margin-bottom: 12px;
}
body.rf .login-heading {
  margin-bottom: 24px;
}
body.rf .login-hint {
  font-size: 13.5px;
  color: var(--text-3);
}
body.rf .login-form {
  gap: 12px;
}

/* the field, with the eye inside */
body.rf .login-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}
body.rf .login-input-wrap {
  position: relative;
}
body.rf .login-input {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--lg-line);
  padding: 0 46px;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-align: center;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
body.rf .login-input[type="password"] {
  letter-spacing: 0.22em;
}
body.rf .login-input::placeholder {
  letter-spacing: 0.04em;
}
:root[data-theme="dark"] body.rf .login-input {
  background: var(--surface-2);
}
body.rf .login-input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 107, 118, 0.13);
}
:root[data-theme="dark"] body.rf .login-input:focus {
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(32, 167, 178, 0.18);
}
body.rf .login-input.is-invalid,
body.rf .login-input.is-invalid:focus {
  border-color: var(--lg-bad-line);
  box-shadow: 0 0 0 3px var(--lg-bad-halo);
}
body.rf .login-eye {
  position: absolute;
  inset-inline-end: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
body.rf .login-eye:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
body.rf .login-eye:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
body.rf .login-eye svg {
  width: 18px;
  height: 18px;
  display: block;
}
body.rf .login-eye .login-eye-off,
body.rf .login-eye.is-on .login-eye-on {
  display: none;
}
body.rf .login-eye.is-on .login-eye-off {
  display: block;
}

/* the button: «כניסה» → spinner + «מתחבר…» → ✓ «מחובר» */
body.rf .login-submit {
  height: 46px;
  border-radius: 10px;
  gap: 8px;
}
body.rf .login-submit:disabled {
  opacity: 1;
}
body.rf .login-spin,
body.rf .login-check {
  display: none;
  flex: none;
}
body.rf .login-spin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: loginSpin 0.8s linear infinite;
}
body.rf .login-submit.is-busy .login-spin {
  display: inline-block;
}
body.rf .login-check {
  width: 17px;
  height: 17px;
}
body.rf .login-submit.is-done .login-check {
  display: block;
}
body.rf .login-submit.is-done .login-check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: loginCheckLine 0.35s ease-out 0.05s forwards;
}
body.rf .login-submit.is-done .login-spin {
  display: none;
}

/* the message: one line under the button, always there, so the card keeps its size */
body.rf .login-error {
  display: block;
  margin: -4px 0 0;
  height: 18px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 18px;
  color: var(--lg-bad);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}
body.rf .login-error.is-warn {
  color: var(--lg-warn);
}
body.rf .login-error.is-shown {
  opacity: 1;
}

@keyframes loginSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes loginCheckLine {
  to {
    stroke-dashoffset: 0;
  }
}
