/* ===================================================
   TaskMasters — Login v2
   Standalone styles. Tokens provided by tokens.css.
   Follows DESIGN.md: "The Quiet Ledger"
   =================================================== */

/* ── Dots background canvas ── */
#lv2-bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Override body bg so the canvas shows through the transparent page layer */
body { background-color: var(--tm-warm); }

/* ── Page ── */
.lv2-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 40px 20px;
  font-family: var(--tm-font-body);
  -webkit-font-smoothing: antialiased;
  position: relative;
  z-index: 1;
}

/* ── Card (two-panel) ── */
.lv2-card {
  display: grid;
  grid-template-columns: 2fr 3fr;
  max-width: 1000px;
  width: 100%;
  border-radius: var(--tm-radius-xl);
  overflow: hidden;
  box-shadow: var(--tm-shadow-hero);
}

/* ─────────────────────────────────────────────────
   Brand panel (left — Deep Ledger Navy)
   ───────────────────────────────────────────────── */
.lv2-brand {
  background: linear-gradient(155deg, var(--tm-navy) 0%, var(--tm-navy-2) 60%, #0d2240 100%);
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--tm-cream);
  position: relative;
  overflow: hidden;
}

/* Gradient shimmer from emerald — very subtle */
.lv2-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 110% 110%, rgba(15, 157, 110, 0.10) 0%, transparent 65%);
  pointer-events: none;
}

/* Faint concentric ring — top-right */
.lv2-brand::after {
  content: '';
  position: absolute;
  width: 340px;
  height: 340px;
  top: -110px;
  right: -110px;
  border-radius: 50%;
  border: 1px solid rgba(250, 250, 245, 0.06);
  pointer-events: none;
}

/* Second ring — bottom-left via a child element */
.lv2-brand__ring {
  position: absolute;
  width: 220px;
  height: 220px;
  bottom: -80px;
  left: -80px;
  border-radius: 50%;
  border: 1px solid rgba(250, 250, 245, 0.05);
  pointer-events: none;
}

.lv2-brand__logo-link {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
  text-decoration: none;
}
.lv2-brand__logo-link img {
  max-width: 150px;
  height: auto;
  width: auto;
}

.lv2-brand__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  position: relative;
  z-index: 1;
}

.lv2-brand__eyebrow {
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--tm-emerald);
  margin-bottom: 10px;
  transition: opacity 200ms ease;
}

.lv2-brand__headline {
  font-family: var(--tm-font-display);
  font-size: clamp(1.7rem, 2.8vw, 2.4rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--tm-cream);
  transition: opacity 200ms ease;
}

.lv2-brand__sub {
  font-size: 0.875rem;
  color: rgba(250, 250, 245, 0.6);
  line-height: 1.65;
  margin-top: 10px;
  transition: opacity 200ms ease;
}

.lv2-brand__points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.lv2-brand__points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.855rem;
  color: rgba(250, 250, 245, 0.75);
  line-height: 1.4;
}

.lv2-brand__points li::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tm-emerald);
  flex-shrink: 0;
}

.lv2-brand__foot {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid rgba(250, 250, 245, 0.09);
  font-size: 0.775rem;
  color: rgba(250, 250, 245, 0.35);
  line-height: 1.55;
  position: relative;
  z-index: 1;
  transition: opacity 200ms ease;
}

/* ─────────────────────────────────────────────────
   Form panel (right — Paper Cream)
   ───────────────────────────────────────────────── */
.lv2-form-panel {
  background: var(--tm-cream);
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Breadcrumb ── */
.lv2-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  align-self: flex-start;
  margin-bottom: -6px;
}

.lv2-breadcrumb__link {
  color: var(--tm-ink-500);
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms ease;
}

.lv2-breadcrumb__link:hover { color: var(--tm-navy); }

.lv2-breadcrumb__sep {
  font-size: 0.65rem;
  color: var(--tm-line-300);
}

.lv2-breadcrumb__current {
  color: var(--tm-ink-700);
  font-weight: 500;
}

/* ── Account type toggle (Client / Operator) — equal-width columns ── */
.lv2-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  align-self: flex-start;
  background: var(--tm-mist-100);
  border-radius: var(--tm-radius-pill);
  padding: 3px;
  border: 1px solid rgba(10, 31, 61, 0.07);
  min-width: 220px;
}

.lv2-toggle__indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: var(--tm-radius-pill);
  background: var(--tm-navy);
  box-shadow: var(--tm-shadow-micro);
  pointer-events: none;
  z-index: 0;
}

.lv2-toggle__btn {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--tm-radius-pill);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--tm-ink-500);
  white-space: nowrap;
  text-align: center;
  transition: color 200ms ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.lv2-toggle__btn[aria-selected="true"] {
  color: var(--tm-cream);
  font-weight: 600;
}
.lv2-toggle__btn i { font-size: 0.9rem; }

/* ── Form heading ── */
.lv2-head { display: flex; flex-direction: column; gap: 5px; }

.lv2-head__title {
  font-family: var(--tm-font-display);
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--tm-navy);
  transition: opacity 200ms ease;
}

.lv2-head__sub {
  font-size: 0.875rem;
  color: var(--tm-ink-500);
  line-height: 1.5;
  transition: opacity 200ms ease;
}

/* ── Form ── */
.lv2-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Field */
.lv2-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Floating label ── */
.lv2-field--float {
  position: relative;
}

/* Default: sits centred in the input like a placeholder */
.lv2-field--float input + label {
  position: absolute;
  left: 14px;
  top: 22px; /* half of 44px input height */
  transform: translateY(-50%);
  font-size: 0.9rem;
  font-weight: 400;
  color: rgba(107, 114, 128, 0.52);
  pointer-events: none;
  z-index: 2;
  line-height: 1;
  white-space: nowrap;
  padding: 0;
  background-color: transparent;
  transition:
    top              200ms cubic-bezier(0.4, 0, 0.2, 1),
    font-size        200ms cubic-bezier(0.4, 0, 0.2, 1),
    color            200ms cubic-bezier(0.4, 0, 0.2, 1),
    left             200ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 160ms cubic-bezier(0.4, 0, 0.2, 1),
    padding          200ms cubic-bezier(0.4, 0, 0.2, 1),
    font-weight      0ms;
}

/* Floated: input is focused OR has a value */
.lv2-field--float input:focus + label,
.lv2-field--float input:not(:placeholder-shown) + label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--tm-ink-700);
  background-color: #ffffff;
  padding: 0 4px;
  left: 10px;
}

/* Active focus: emerald label colour */
.lv2-field--float input:focus + label {
  color: var(--tm-emerald);
}

/* Forgot password + Need help row under password */
.lv2-field__bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.lv2-field__forgot {
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--tm-emerald);
  text-decoration: none;
  transition: color 150ms ease;
}
.lv2-field__forgot:hover { color: var(--tm-emerald-deep); }

.lv2-help-inline {
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--tm-ink-500);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 150ms ease;
}
.lv2-help-inline:hover { color: var(--tm-ink-700); }
.lv2-help-inline i { font-size: 0.78rem; }

.lv2-field__input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--tm-line-300);
  border-radius: var(--tm-radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--tm-ink-900);
  background: #ffffff;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.lv2-field__input:focus {
  border-color: var(--tm-emerald);
  box-shadow: 0 0 0 3px rgba(15, 157, 110, 0.12);
}

/* Password input with eye button */
.lv2-field__input-wrap { position: relative; }
.lv2-field__input-wrap .lv2-field__input { padding-right: 46px; }

.lv2-field__eye {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tm-ink-500);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--tm-radius-sm);
}
.lv2-field__eye:hover { color: var(--tm-ink-700); }
.lv2-field__eye i { font-size: 1rem; line-height: 1; }

/* ── Primary submit button ── */
.lv2-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 26px;
  background: var(--tm-emerald);
  color: var(--tm-cream);
  border: none;
  border-radius: var(--tm-radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    box-shadow       150ms ease,
    transform        100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.lv2-btn-primary:hover {
  background: var(--tm-emerald-deep);
  box-shadow: 0 4px 18px rgba(15, 157, 110, 0.28);
}
.lv2-btn-primary:active { transform: scale(0.99); }
.lv2-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.lv2-btn-primary i { font-size: 0.9rem; }

/* ── Divider ── */
.lv2-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--tm-ink-500);
  letter-spacing: 0.04em;
}
.lv2-divider::before,
.lv2-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--tm-line-200);
}

/* ── Footer help text ── */
.lv2-footer-help {
  text-align: center;
  font-size: 0.82rem;
  color: var(--tm-ink-500);
}
.lv2-footer-help a {
  color: var(--tm-emerald);
  text-decoration: none;
  font-weight: 500;
}
.lv2-footer-help a:hover { color: var(--tm-emerald-deep); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .lv2-brand { display: none; }

  .lv2-page {
    padding: 24px 16px;
    /* align-items: flex-start; */
  }

  .lv2-card {
    grid-template-columns: 1fr;
    box-shadow: 0 8px 40px rgba(10, 31, 61, 0.14), 0 1px 4px rgba(10, 31, 61, 0.06);
  }

  .lv2-form-panel {
    padding: 36px 28px 48px;
    border-radius: var(--tm-radius-xl);
    gap: 18px;
  }

  /* Show logo */
  .lv2-mobile-logo {
    display: flex !important;
    margin-bottom: 6px;
  }

  /* Center breadcrumb */
  .lv2-breadcrumb {
    align-self: center;
    margin-bottom: -4px;
  }

  /* Stretch toggle full-width and center it */
  .lv2-toggle {
    align-self: stretch;
    min-width: unset;
  }

  /* Center heading block */
  .lv2-head {
    text-align: center;
  }

  /* Taller inputs for touch comfort */
  .lv2-field__input {
    height: 50px;
  }

  /* Floating label: recenter for 50px input height */
  .lv2-field--float input + label {
    top: 25px;
  }

  /* Taller sign-in button */
  .lv2-btn-primary {
    padding: 15px 26px;
    font-size: 1rem;
  }
}

@media (max-width: 420px) {
  .lv2-page {
    align-items: flex-start;
    padding: 18px 12px 28px;
  }

  .lv2-form-panel {
    padding: 28px 20px 34px;
    gap: 16px;
  }

  .lv2-mobile-logo img {
    height: 76px;
  }

  .lv2-toggle__btn {
    padding-left: 8px;
    padding-right: 8px;
    font-size: 0.8rem;
  }
}

/* Hidden on desktop, shown on mobile */
.lv2-mobile-logo {
  display: none;
  justify-content: center;
  margin-bottom: 8px;
}

.lv2-mobile-logo img {
  height: 94px;
  width: auto;
}

/* ── Page-load entrance animation ── */
@keyframes lv2-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lv2-card {
  animation: lv2-fade-up 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .lv2-card { animation: none; }
}

/* ── Form error banner ── */
.lv2-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.875rem;
  line-height: 1.4;
  padding: 10px 14px;
}
.lv2-error.is-visible { display: block; }
