/* Tokens mirror the User App (application/global.css, lib/colors.ts, tailwind.config.js). */
@font-face { font-family: "Anybody"; src: url("/assets/fonts/Anybody-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/assets/fonts/OpenSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("/assets/fonts/OpenSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --primary: #e86e4a;
  --primary-hover: rgba(232, 110, 74, 0.6);
  --background: #f5f5f5;
  --surface: #ffffff;
  --main-text: #1c1c1c;
  --secondary-text: #444444;
  --tertiary-text: #737373;
  --disabled: #e5e5e5;
  --on-disabled: #acacac;
  --red: #e95555;
  --red-bg: #ffe3e3;
  --green: #5cae5e;
  --green-bg: #ebfcec;
  --radius-pill: 999px;
  --input-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--main-text);
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.layout { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Left half on wide screens, like LoginWide in the User App */
.hero { display: none; position: relative; width: 50%; overflow: hidden; }
.hero-shape { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-image { position: relative; width: 100%; height: 100%; object-fit: contain; }

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px calc(16px + env(safe-area-inset-bottom));
}
.panel-inner { width: 100%; max-width: 420px; flex: 1; display: flex; flex-direction: column; }

.logo { display: block; width: 180px; height: auto; margin: 8px auto 40px; }

#view { flex: 1; display: flex; flex-direction: column; }

h1 {
  font-family: "Anybody", "Open Sans", sans-serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 36px;
  margin: 0 0 20px;
  text-align: center;
}

.text { color: var(--secondary-text); margin: 0 0 16px; }
.text strong { color: var(--main-text); font-weight: 700; overflow-wrap: anywhere; }

.status-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  margin: 8px auto 24px;
}
.status-icon.ok { background: var(--green-bg); color: var(--green); }
.status-icon.bad { background: var(--red-bg); color: var(--red); }
.status-icon svg { width: 36px; height: 36px; }
.centered { text-align: center; }

/* Form, matching changePassword in the User App */
form { display: flex; flex-direction: column; flex: 1; }
.field { margin: 12px 0 16px; }
.label { display: block; font-size: 14px; line-height: 20px; margin: 0 0 8px 16px; }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  box-shadow: var(--input-shadow);
  padding: 0 4px 0 12px;
  transition: border-color 0.15s;
}
.input-wrap:focus-within { border-color: var(--main-text); box-shadow: none; }
.input-wrap.error { border-color: var(--red); box-shadow: none; }
.input-wrap .lock { flex: none; width: 24px; height: 24px; color: var(--tertiary-text); }

.input-wrap input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px; /* 16px keeps iOS Safari from zooming in */
  color: var(--main-text);
  padding: 0 8px 0 12px;
}
.input-wrap input::placeholder { color: var(--on-disabled); letter-spacing: 2px; }

.toggle {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 50%;
  color: var(--main-text);
  cursor: pointer;
}
.toggle:disabled { opacity: 0.5; cursor: default; }
.toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.toggle svg { width: 24px; height: 24px; }

.hint, .field-error {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; line-height: 16px;
  margin: 8px 0 0 16px;
}
.hint { color: var(--tertiary-text); }
.field-error { color: var(--red); }
.field-error svg { flex: none; width: 16px; height: 16px; }

.banner {
  background: var(--red-bg); color: var(--red);
  border-radius: 16px; padding: 12px 16px; margin: 0 0 16px;
  font-size: 14px;
}

.spacer { flex: 1; min-height: 24px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn:hover { background: var(--primary-hover); }
.btn:focus-visible { outline: 2px solid var(--main-text); outline-offset: 2px; }
.btn:disabled { background: var(--disabled); color: var(--on-disabled); cursor: default; }
.btn.secondary { background: var(--surface); color: var(--main-text); border: 1px solid var(--disabled); margin-top: 12px; }
.btn.secondary:hover { background: #fafafa; }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.loading { display: grid; place-items: center; flex: 1; color: var(--primary); }
.loading .spinner { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  width: 100%; max-width: 420px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 32px;
  font-size: 13px; color: var(--tertiary-text);
}
.footer a { color: var(--tertiary-text); }
.lang select {
  font: inherit; color: var(--secondary-text);
  background: transparent; border: 1px solid var(--disabled); border-radius: var(--radius-pill);
  padding: 4px 10px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.noscript { text-align: center; padding: 24px; }

/* Phones and tablets: image band on top like the native login (login_rowers.png),
   content below like the Figma "Change password" screens, button right under the field. */
@media (max-width: 899px) {
  .layout { flex-direction: column; }
  .hero {
    display: block;
    width: 100%;
    height: clamp(180px, 32vh, 280px);
    flex: none;
  }
  .hero-image {
    position: absolute; top: calc(52px + env(safe-area-inset-top)); left: 0;
    width: 100%; height: calc(100% - 52px - env(safe-area-inset-top));
    object-fit: cover;
    object-position: 50% 55%; /* the machines sit in the middle band of the image */
  }
  .hero-logo {
    position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 50%;
    transform: translateX(-50%);
    width: 150px; height: auto;
  }
  .panel { padding-top: 8px; }
  .panel-inner { max-width: 480px; }
  .logo { display: none; }
  #view { flex: none; }
  /* Status pages are short: centre them in the space between image and footer. */
  #view[data-kind="status"] { flex: 1; justify-content: center; padding-bottom: 24px; }
  h1 { font-size: 28px; line-height: 32px; margin-bottom: 16px; }
  .status-icon { width: 56px; height: 56px; margin: 4px auto 16px; }
  .spacer { flex: none; min-height: 28px; }
  .footer { max-width: 480px; margin-top: auto; padding-top: 32px; }
}

/* Tablets portrait: the band is wide, so cap the image width; otherwise the crop cuts the wheels. */
@media (min-width: 600px) and (max-width: 899px) {
  .hero { height: clamp(260px, 32vh, 340px); }
  .hero-image { width: min(100%, 560px); left: 50%; transform: translateX(-50%); }
  .panel { padding-top: 24px; }
}

.hero-logo { display: none; }
@media (max-width: 899px) { .hero-logo { display: block; } }

@media (min-width: 900px) {
  .hero { display: block; }
  .panel { width: 50%; flex: none; justify-content: center; padding: 48px 32px; }
  .panel-inner { flex: none; }
  .logo { margin-bottom: 48px; }
  .spacer { flex: none; min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { transition: none !important; }
}
