/*
 * Strona logowania tenanta white label (docs/white-label/SPEC.md §9.5) — rama dla logowania,
 * resetu hasła i przyjęcia zaproszenia na domenie tenanta.
 *
 * ⛔ Żadnych hexów marki w tym pliku. Wszystkie kolory marki wchodzą jako CSS custom properties
 * na <html> (--brand, --on-brand, --link, --page, --border, --accent, --on-brand-soft,
 * --on-brand-muted) wyliczone przez App\Tenant\Branding\Theme\BrandThemeResolver.
 * Paleta neutralna (karta, tekst, alert błędu) jest stała i NIE zależy od marki.
 */

:root {
  --tl-ink: #1f1b18;
  --tl-ink-soft: #5b544f;
  --tl-ink-muted: #8a827c;
  --tl-card: #ffffff;
  --tl-field-border: #d9d4cf;
  --tl-danger-bg: #fdecec;
  --tl-danger-border: #f5b5b5;
  --tl-danger-text: #8a1c1c;
  --tl-success-bg: #e9f7ee;
  --tl-success-border: #b7e3c5;
  --tl-success-text: #1d5c32;
  --tl-radius: 20px;
  --tl-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html, body { height: 100%; }

body.tenant-login {
  margin: 0;
  font-family: var(--tl-font);
  color: var(--tl-ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

.tenant-login *:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.tl-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}

/* ── Kolumna marki ───────────────────────────────────────────────────────── */
.tl-brand {
  background: var(--brand);
  color: var(--on-brand);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}

.tl-brand__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.tl-brand__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  min-height: 44px;
}

.tl-brand__logo img {
  max-height: 44px;
  max-width: 220px;
  width: auto;
  height: auto;
  display: block;
}

.tl-brand__tag {
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--on-brand-soft);
  white-space: nowrap;
}

.tl-brand__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 0 8px;
}

.tl-brand__headline {
  font-size: clamp(1.6rem, 2.2vw + 1rem, 2.75rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 0 0 12px;
  color: var(--on-brand);
}

.tl-brand__lead {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--on-brand-soft);
  margin: 0 0 24px;
  max-width: 52ch;
}

.tl-brand__bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.tl-brand__bullets li {
  position: relative;
  padding-left: 22px;
  line-height: 1.5;
  color: var(--on-brand);
}

.tl-brand__bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .55em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.tl-brand__tagline {
  display: none;
  margin: 0;
  padding-top: 16px;
  color: var(--on-brand-muted);
  font-size: .9rem;
}

.tl-brand__tagline::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  margin-bottom: 10px;
}

/* Chip nad nagłówkiem (zaproszenie) i przełącznik segmentowy w karcie. */
.tl-chip {
  display: inline-block;
  align-self: flex-start;
  padding: 6px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  border: 1px solid var(--on-brand-muted);
  color: var(--on-brand-soft);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tl-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.tl-segment__btn {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tl-ink-soft);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tl-segment__btn[aria-selected="true"] {
  background: var(--brand);
  color: var(--on-brand);
}

.tl-segment__panel[hidden] { display: none; }

/* ── Kolumna formularza ─────────────────────────────────────────────────── */
.tl-main {
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--page);
}

.tl-main__top {
  display: flex;
  justify-content: flex-end;
  min-height: 44px;
}

.tl-main__center {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.tl-card {
  width: 100%;
  max-width: 440px;
  background: var(--tl-card);
  border: 1px solid var(--border);
  border-radius: var(--tl-radius);
  padding: 28px 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
}

.tl-card--wide { max-width: 720px; }

.tl-card h1, .tl-card h2, .tl-card .tl-card__title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--tl-ink);
}

.tl-card__subtitle {
  margin: 0 0 22px;
  color: var(--tl-ink-soft);
  font-size: .95rem;
}

.tl-card a { color: var(--link); }

.tl-field { margin-bottom: 18px; }

.tl-field__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.tl-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--tl-ink-soft);
  margin-bottom: 6px;
}

.tl-input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--tl-ink);
  background: #fff;
  border: 1px solid var(--tl-field-border);
  border-radius: 12px;
  box-sizing: border-box;
}

.tl-input:focus {
  border-color: var(--brand);
  outline: 2px solid var(--brand);
  outline-offset: 0;
}

.tl-input.is-invalid { border-color: var(--tl-danger-border); }

/* Przycisk „pokaż hasło” wstawia kontroler password-toggle (wspólny z platformą).
   Reguły na `.password-field` BEZ wymogu rodzica `.tl-password` (poprawka 03.11): formularze
   z Symfony Form w ramie tenanta (rejestracja z zaproszenia, zaproszenie pracownika) mają pola
   `form-control-lg` bez tego rodzica, a ten dokument nie ładuje form-messages.css — przycisk
   zostawał w przepływie (`position: static`) i lądował pod polem. */
.tl-password { position: relative; }
.tl-password .tl-input,
.password-field > input { padding-right: 52px; }
.password-field { position: relative; display: block; }
.password-field > input { width: 100%; }
.password-field__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--tl-ink-soft);
  cursor: pointer;
  border-radius: 10px;
}

.tl-link {
  font-size: .85rem;
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.tl-link:hover { text-decoration: underline; }

.tl-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  min-height: 44px;
}

.tl-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  margin: 0;
}

.tl-check label { font-size: .95rem; color: var(--tl-ink-soft); }

.tl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* <a class="tl-btn"> (np. Google) domyślnie ma content-box — bez tego width:100% + padding wystaje z karty. */
  box-sizing: border-box;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-brand);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s ease;
}

.tl-btn:hover { filter: brightness(.94); }
.tl-btn:focus-visible { outline-offset: 3px; }

.tl-btn--ghost {
  background: transparent;
  color: var(--link);
  border-color: var(--border);
}

.tl-help {
  margin: 18px 0 0;
  font-size: .9rem;
  color: var(--tl-ink-soft);
  text-align: center;
}

.tl-alert {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .95rem;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.tl-alert--danger {
  background: var(--tl-danger-bg);
  border-color: var(--tl-danger-border);
  color: var(--tl-danger-text);
}

.tl-alert--success {
  background: var(--tl-success-bg);
  border-color: var(--tl-success-border);
  color: var(--tl-success-text);
}

.tl-alert--info {
  background: var(--page);
  border-color: var(--border);
  color: var(--tl-ink);
}

.tl-alert ul { margin: 6px 0 0; padding-left: 18px; }

.tl-footer {
  font-size: .8rem;
  color: var(--tl-ink-muted);
  text-align: center;
  padding: 12px 0 4px;
}

.tl-footer p { margin: 0 0 4px; }
.tl-footer a { color: inherit; }

/* ── Przełącznik języka ─────────────────────────────────────────────────── */
.tl-lang { position: relative; }

.tl-lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}

.tl-main .tl-lang__btn { color: var(--tl-ink); border-color: var(--border); background: #fff; }
.tl-brand .tl-lang__btn { color: var(--on-brand); border-color: var(--on-brand-muted); }

.tl-lang__btn svg { width: 18px; height: 18px; }

.tl-lang__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  color: var(--tl-ink);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
  display: none;
  z-index: 20;
}

.tl-lang__menu.show { display: block; }

.tl-lang__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--tl-ink);
  text-decoration: none;
  font-size: .95rem;
}

.tl-lang__item:hover { background: var(--page); }
.tl-lang__item.active { background: var(--page); font-weight: 700; }
.tl-lang__code { font-size: .75rem; color: var(--tl-ink-muted); text-transform: uppercase; letter-spacing: .06em; }

/* Mobile: lewa kolumna zwija się do nagłówka (logo + język + headline); bez leadu i punktów. */
.tl-brand .tl-lang { display: block; }
.tl-main__top { display: none; }
.tl-brand__lead, .tl-brand__bullets, .tl-brand__tag { display: none; }

@media (min-width: 960px) {
  .tl-layout { grid-template-columns: minmax(360px, 46%) 1fr; }
  .tl-brand { padding: 32px 48px; }
  .tl-brand .tl-lang { display: none; }
  .tl-brand__lead, .tl-brand__bullets, .tl-brand__tagline { display: block; }
  .tl-brand__tag { display: inline; }
  .tl-brand__body { padding: 40px 0; }
  .tl-main { padding: 24px 32px; }
  .tl-main__top { display: flex; }
  .tl-card { padding: 36px 32px; }
}

/* Logowanie Google na hoście tenanta (docs/GOOGLE-LOGIN-PLAN.md §5.4) — paleta neutralna, nie z koloru marki. */
.tl-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: #6b7280;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tl-divider::before,
.tl-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.tl-btn--google {
  gap: 12px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  box-shadow: none;
  text-decoration: none;
}
.tl-btn--google:hover,
.tl-btn--google:focus-visible {
  background: #f8f9fa;
  color: #1f1f1f;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .3);
}
.tl-btn--google .btn-google__logo {
  flex: 0 0 18px;
}
