/*
 * Login page styling. Base palette and control normalization come from the
 * shared production chrome stylesheet (app-chrome.css) + wcs-colors.js; the
 * dark top bar comes from apps/shared/ui-components/brand-bar.css.
 * Everything below is this page's own layout on top of those.
 * Ported from the frontend/desings/login/ UI concept — see that
 * directory's README for the design's origin.
 */

:root {
  --login-card-width: 390px;
  --login-page-gutter: clamp(18px, 4vw, 56px);
  --login-map-wash: rgba(242, 239, 232, 0.92);
  --login-map-wash-soft: rgba(242, 239, 232, 0.18);
  --login-card-bg: rgba(255, 250, 240, 0.96);
  --login-card-shadow: 0 24px 60px rgba(30, 16, 8, 0.2);
  --login-focus-ring: rgba(122, 72, 32, 0.22);
  --login-danger: #9a2f24;
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  outline-offset: 3px;
}

.login-page {
  position: relative;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr) auto;
  min-height: 100vh;
  isolation: isolate;
  background:
    linear-gradient(
      90deg,
      var(--login-map-wash) 0%,
      rgba(242, 239, 232, 0.82) 33%,
      var(--login-map-wash-soft) 72%,
      rgba(242, 239, 232, 0.04) 100%
    ),
    url("/static/menu-bg.png") center right / cover no-repeat,
    var(--bg);
}

.login-page::after {
  position: fixed;
  inset: 40px 0 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 250, 240, 0.86), transparent 31%),
    linear-gradient(180deg, rgba(122, 72, 32, 0.05), transparent 34%);
}

.login-stage {
  display: flex;
  align-items: center;
  width: min(1180px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 36px var(--login-page-gutter);
}

.login-card {
  width: min(100%, var(--login-card-width));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--login-card-bg);
  box-shadow: var(--login-card-shadow);
  backdrop-filter: blur(8px);
}

.card-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.card-heading h1 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.card-heading p {
  max-width: 32ch;
  color: var(--textDim);
  font-size: 12px;
  line-height: 1.55;
}

.auth-form,
.field-group {
  display: flex;
  flex-direction: column;
}

.auth-form {
  gap: 14px;
}

.field-group {
  gap: 5px;
}

.field-group label,
.field-label-row {
  color: var(--textMid);
  font-size: 11px;
  font-weight: 700;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-group input {
  width: 100%;
  height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--borderInput);
  border-radius: 5px;
  outline: none;
  color: var(--text);
  background: rgba(244, 234, 216, 0.7);
  font-size: 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.field-group input::placeholder {
  color: var(--textMuted);
}

.field-group input:hover {
  border-color: var(--borderBright);
}

.field-group input:focus-visible {
  border-color: var(--accent);
  background: #fffdf8;
  box-shadow: 0 0 0 3px var(--login-focus-ring);
}

.field-group input[aria-invalid="true"] {
  border-color: var(--login-danger);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 52px;
}

.password-toggle,
.text-button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.password-toggle:hover,
.text-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 9px;
  min-width: 34px;
  transform: translateY(-50%);
  text-align: right;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.primary-button {
  color: #fffaf0;
  background: var(--accent);
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.secondary-button {
  color: var(--textMid);
  background: rgba(255, 255, 255, 0.48);
}

.secondary-button:hover {
  color: var(--text);
  background: var(--surfaceActive);
}

.form-status {
  display: none;
  min-height: 28px;
  padding: 6px 8px;
  border-left: 3px solid var(--accent);
  color: var(--textMid);
  background: var(--accent-soft);
  font-size: 10px;
  line-height: 1.45;
}

.form-status.has-message {
  display: block;
}

.form-status.is-error {
  border-left-color: var(--login-danger);
  color: var(--login-danger);
  background: rgba(154, 47, 36, 0.08);
}

.account-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--textMuted);
  font-size: 10px;
  line-height: 1.45;
}

.account-note-title {
  color: var(--textMid);
  font-weight: 700;
}

.page-footer {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 12px var(--login-page-gutter) 16px;
  color: rgba(30, 16, 8, 0.74);
  font-size: 10px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .login-page {
    background:
      linear-gradient(rgba(242, 239, 232, 0.84), rgba(242, 239, 232, 0.84)),
      url("/static/menu-bg.png") center / cover no-repeat,
      var(--bg);
  }

  .login-stage {
    align-items: flex-start;
    padding-top: 28px;
  }

  .login-card {
    padding: 20px;
  }

  .page-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 380px) {
  .brand-name {
    font-size: 11px;
  }

  .field-label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
