/* ===== LOGIN / REGISTER PAGE ===== */
.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: var(--bg);
}

.auth-box {
  width: min(1180px, 100%);
  height: min(760px, calc(100vh - 56px));
  min-height: min(650px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-raised);
}

/* ---------- LEFT SIDE ---------- */
.auth-visual {
  position: relative;
  overflow: hidden;
  background: #f4dce0;
  color: var(--text);
  min-height: 420px;
}
.auth-visual-photo {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.auth-visual-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg,
    rgba(255, 251, 251, .42) 0%,
    rgba(255, 251, 251, .28) 42%,
    rgba(255, 251, 251, .08) 68%,
    rgba(76, 0, 14, .12) 78%,
    rgba(68, 0, 14, .4) 100%);
}
.auth-visual::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -150px;
  left: -110px;
  width: 390px;
  height: 245px;
  border-radius: 0 0 100% 0;
  background: rgba(165, 12, 31, .88);
  transform: rotate(-13deg);
  box-shadow: 0 17px 0 rgba(198, 29, 47, .42), 0 34px 0 rgba(255, 255, 255, .58);
  pointer-events: none;
}

.auth-branding {
  position: absolute;
  left: 60px;
  top: 76px;
  width: min(490px, calc(100% - 88px));
  z-index: 4;
  padding: 0;
  text-shadow: none;
}
.auth-branding::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -16px;
  border-radius: 14px;
  background: rgba(248, 250, 255, .78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  box-shadow: 0 8px 26px rgba(17, 35, 58, .12);
  pointer-events: none;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 24px;
}
.auth-logo {
  flex: 0 0 118px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(12, 35, 57, .2);
}
.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}
.auth-kicker {
  display: flex;
  flex-direction: column;
  padding-left: 20px;
  border-left: 2px solid var(--red);
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .025em;
}
.auth-kicker strong {
  font-size: 29px;
  letter-spacing: -.03em;
  line-height: 1.12;
}
.auth-kicker .auth-city {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: .26em;
}
.auth-branding h1 {
  max-width: 450px;
  font-size: 29px;
  line-height: 1.08;
  letter-spacing: -.035em;
  margin: 0 0 16px;
  color: var(--text);
}
.auth-branding h1 span,
.auth-branding h1 em { display: block; }
.auth-branding h1 em {
  margin-top: 1px;
  color: var(--red);
  font-size: 34px;
  font-style: italic;
  font-weight: 800;
  line-height: 1;
}
.auth-branding p {
  max-width: 390px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

/* Bottom bar */
.auth-features {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px 13px;
  background: linear-gradient(180deg, rgba(110, 15, 35, 0) 0%, rgba(125, 22, 44, .78) 25%, #a70f1b 100%);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.auth-features > div { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.auth-features b { font-size: 17px; line-height: 1; }
.auth-features i { height: 20px; width: 1px; background: rgba(255, 255, 255, .75); }

/* ---------- RIGHT SIDE ---------- */
.auth-page .chatbtn,
.auth-page .chat { display: none; }

.auth-form {
  position: relative;
  padding: 32px 36px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--surface) 32%, var(--surface) 68%, #fff8f9);
}
.auth-form::before {
  content: "";
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 140px;
  background: url("../assets/images/auth-footer.svg?v=buildings-up2") right bottom / 100% 100% no-repeat;
  pointer-events: none;
}
.auth-tabs,
.auth-heading,
#loginForm,
#registerForm,
#recoveryPanel {
  position: relative;
  z-index: 1;
}
.auth-tabs { grid-row: 1; }
.auth-heading { grid-row: 2; }
#loginForm,
#registerForm,
#recoveryPanel { grid-row: 3; }

.auth-tabs {
  display: flex;
  width: 100%;
  background: #f0eff3;
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 0;
  background: none;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.auth-tabs .on {
  background: #fff;
  color: var(--red);
  border-bottom-color: var(--red);
  box-shadow: 0 2px 7px rgba(23, 32, 51, .1);
}
.auth-tabs button:focus-visible,
.pw-toggle:focus-visible,
.auth-register button:focus-visible {
  outline: 3px solid rgba(143, 29, 51, .28);
  outline-offset: 2px;
}
.auth-password-help button:focus-visible,
.recovery-back:focus-visible {
  outline: 3px solid rgba(143, 29, 51, .28);
  outline-offset: 2px;
}
.auth-submit:disabled {
  cursor: wait;
  opacity: .7;
}

.auth-heading h2 { font-size: 26px; letter-spacing: -.045em; margin: 0 0 7px; color: var(--text); }
.auth-heading p { font-size: 12px; line-height: 1.6; margin: 0 0 18px; color: var(--muted); }
.auth-heading { min-height: 96px; }

.auth-form .field input,
.auth-form .field input,
.auth-form .field select { height: 40px; }
.auth-form .field input,
.auth-form .field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border-color: var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 13px;
}
.auth-form .field input:autofill,
.auth-form .field input:-webkit-autofill,
.auth-form .field input:-webkit-autofill:hover,
.auth-form .field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}
.auth-form .field label { font-size: 11px; }
.auth-form .notice {
  position: relative;
  padding-left: 40px;
  background: #fff0f1;
  border-color: #ffd1d5;
  color: #ae101c;
  border-radius: 12px;
  font-size: 10px;
}
.auth-form .notice::before {
  content: "!";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d21c27;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

#loginForm,
#registerForm,
#recoveryPanel {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 13px;
  font-size: 11px;
}
.auth-password-help {
  display: flex;
  justify-content: flex-end;
  margin-top: 7px;
}
.auth-password-help button,
.recovery-back {
  border: 0;
  padding: 2px 0;
  background: none;
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
}
.auth-password-help button:hover,
.recovery-back:hover { color: var(--red-dark); text-decoration: underline; }
.recovery-form {
  width: 100%;
  min-width: 0;
  min-height: 0;
}
.recovery-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.recovery-form .recovery-back {
  display: block;
  margin: 13px auto 0;
}
.recovery-success {
  padding: 10px 0;
  text-align: center;
}
.recovery-success-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 24px;
  font-weight: 800;
}
.recovery-success h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}
.recovery-success p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.remember { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.remember input { accent-color: var(--red); }

.auth-submit { width: 100%; height: 42px; font-size: 13px; border-radius: 9px; }
.auth-form .btn.primary {
  background: var(--red);
  box-shadow: 0 6px 14px rgba(143, 29, 51, .18);
}
.auth-form .btn.primary:hover { background: var(--red-dark); }
.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: #7b8490;
  font-size: 10px;
  margin: 10px 0;
}
.auth-or span { height: 1px; background: #e2e5e9; flex: 1; }
.auth-create { width: 100%; height: 38px; color: var(--red); border: 1px solid var(--red); border-radius: var(--radius-control); font-size: 12px; }

.auth-register { text-align: center; color: #68717e; font-size: 11px; margin-top: 16px; }
.auth-register button {
  border: 0;
  background: none;
  color: var(--red);
  font-weight: 800;
  padding: 0 0 0 4px;
}

.register-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 11px; }
.register-grid .full { grid-column: 1 / -1; }

/* ---------- Password eye ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--muted);
  padding: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.pw-toggle:hover { color: var(--red); }
.pw-toggle .eye-open { display: none; }
.pw-toggle.shown .eye-open { display: block; }
.pw-toggle.shown .eye-closed { display: none; }

@media (min-width: 901px) and (max-width: 1100px) {
  .auth-branding {
    left: 44px;
    width: calc(100% - 66px);
  }
  .auth-brand { gap: 18px; margin-bottom: 14px; }
  .auth-logo { flex-basis: 78px; width: 78px; height: 78px; }
  .auth-kicker { padding-left: 16px; font-size: 12px; }
  .auth-kicker strong { font-size: 20px; }
  .auth-kicker .auth-city { font-size: 10px; }
  .auth-branding h1 { max-width: 350px; font-size: 23px; line-height: 1.14; }
  .auth-branding h1 em { font-size: 29px; }
  .auth-branding p { max-width: 350px; font-size: 12px; line-height: 1.5; }
}

@media (min-width: 1101px) {
  .auth-branding h1 span { white-space: nowrap; }
}

/* ---------- Tablet / Mobile ---------- */
@media (max-width: 900px) {
  .auth { padding: 0; align-items: flex-start; }
  .auth-box {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 330px minmax(0, 1fr);
    border-radius: 0;
    border: 0;
  }
  .auth-visual { height: auto; min-height: 0; }
  .auth-visual::before { top: -175px; left: -180px; }
  .auth-branding { left: 24px; right: 20px; top: 26px; width: auto; }
  .auth-branding::before { inset: -10px -12px; }
  .auth-brand { gap: 12px; margin-bottom: 12px; }
  .auth-logo { flex-basis: 56px; width: 56px; height: 56px; }
  .auth-kicker { padding-left: 12px; font-size: 10px; }
  .auth-kicker strong { font-size: 16px; }
  .auth-kicker .auth-city { font-size: 9px; }
  .auth-branding h1 { font-size: 19px; margin-bottom: 8px; }
  .auth-branding h1 em { font-size: 23px; }
  .auth-branding p { font-size: 11px; line-height: 1.35; }
  .auth-features { padding: 12px 10px; gap: 8px; font-size: 9px; justify-content: center; }
  .auth-features b { font-size: 14px; }
  .auth-features i { height: 18px; }
  .auth-form { padding: 24px 20px 32px; }
  .auth-form::before { height: 140px; }
  .auth-heading h2 { font-size: 24px; }
  .register-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .auth-box { grid-template-rows: 245px minmax(0, 1fr); }
  .auth-visual { min-height: 0; }
  .auth-branding::before { inset: -8px -10px; }
  .auth-features > div:last-of-type,
  .auth-features > i:last-of-type { display: none; }
  .auth-form { padding: 18px 16px 24px; }
  .auth-form::before { height: 110px; }
  .auth-tabs { margin-bottom: 18px; }
  .auth-heading { min-height: 0; }
  .auth-heading p { margin-bottom: 16px; }
}