/* ── Auth Pages Styles ── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-dark);
  padding: var(--space-lg);
}

.auth-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.auth-logo .wordmark {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--color-text);
  letter-spacing: -1.5px;
}

.auth-logo .underline {
  width: 80px;
  height: 2px;
  background: var(--color-coral);
  border-radius: 2px;
}

.auth-logo .tagline {
  font-size: 0.65rem;
  letter-spacing: 4px;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
}

.auth-form .form-group {
  margin-bottom: var(--space-md);
}

.auth-form .btn {
  width: 100%;
  padding: 12px;
  margin-top: var(--space-sm);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.auth-footer a {
  color: var(--color-teal);
  font-weight: 700;
}

/* ── Background Animation (subtle) ── */
.auth-container::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(75, 191, 176, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(232, 82, 58, 0.04) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
}

/* ── Split Login Layout (login page only) ── */
.login-split {
  min-height: 100vh;
  display: flex;
  background: var(--color-white);
}

.login-panel {
  flex: 0 0 40%;
  max-width: 40%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  background: var(--color-white);
}

.login-panel-inner {
  width: 100%;
  max-width: 380px;
}

.login-panel .auth-logo {
  margin-bottom: var(--space-2xl);
}

.login-panel .auth-title {
  text-align: left;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

.login-panel-legal {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.login-showcase {
  flex: 1 1 60%;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background: #101820;
}

.login-showcase-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 900px) {
  .login-showcase {
    display: none;
  }
  .login-panel {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* ── Password policy checklist (set-password page) ── */
.password-rules {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  font-size: 0.78rem;
  line-height: 1.9;
}

.password-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
}

.password-rules li::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  box-sizing: border-box;
}

.password-rules li.ok {
  color: var(--color-teal);
  font-weight: 700;
}

.password-rules li.ok::before {
  border-color: var(--color-teal);
  background: var(--color-teal);
}

/* ── Sign-up entry points on the login panel ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--space-lg) 0 var(--space-md);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.btn-join {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  border: 1.5px solid var(--color-teal);
  color: var(--color-teal);
  background: transparent;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-join:hover {
  background: var(--color-teal);
  color: var(--color-white);
}

.auth-footer-secondary {
  margin-top: var(--space-md);
  font-size: 0.75rem;
}

.resend-form {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px dashed var(--color-border);
}

.resend-form .form-label {
  font-size: 0.75rem;
}

/* ── Sign-up page (/join) ── */
.join-panel {
  flex: 0 0 46%;
  max-width: 46%;
}

.join-panel .login-panel-inner {
  max-width: 460px;
}

.join-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.join-form .phone-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 8px;
}

.join-form .phone-row select {
  min-width: 0;
}

.join-section-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: var(--space-lg) 0 var(--space-sm);
}

.join-optional-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 8px;
  margin-inline-start: 6px;
  text-transform: none;
  letter-spacing: 0;
}

.join-legal {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-md);
  text-align: center;
}

.join-benefits {
  list-style: none;
  margin: 0 0 var(--space-lg);
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.join-benefits li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.join-benefits li::before {
  content: "✓";
  color: var(--color-teal);
  font-weight: 900;
}

.field-error {
  border-color: var(--color-coral) !important;
}

.join-error-text {
  color: var(--color-coral);
  font-size: 0.75rem;
  margin-top: 4px;
  min-height: 1em;
}

/* ── "Check your inbox" confirmation ── */
.join-sent-card {
  text-align: center;
}

.join-sent-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  border-radius: 50%;
  background: rgba(75, 191, 176, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-teal);
}

@media (max-width: 900px) {
  .join-panel {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .join-form .form-row {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════
   PRE-LOGIN LANGUAGE SWITCHER + RTL
   ══════════════════════════════════════════════════════════════
   The sign-in pages pick their language from the visitor's country
   (see _prelogin_language()), so they need both a visible override and
   the same RTL treatment as the rest of the console. */

.auth-lang {
  position: absolute;
  top: 18px;
  /* Logical inset: trailing corner in both directions, so it never collides
     with the logo on the leading side. */
  inset-inline-end: 20px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

.auth-lang-item {
  padding: 4px 9px;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

a.auth-lang-item:hover {
  background: rgba(75, 191, 176, 0.12);
  color: var(--color-teal-dark, #2f8d80);
}

.auth-lang-item.is-active {
  background: rgba(75, 191, 176, 0.16);
  color: var(--color-teal-dark, #2f8d80);
  cursor: default;
}

/* The auth card and the join card are the positioning context for the
   switcher; the login split panel already is (position: relative). */
.auth-card,
.join-card {
  position: relative;
}

/* On the narrow split panel the switcher sits inside the panel, not the page. */
.login-panel .auth-lang {
  top: 16px;
}

@media (max-width: 480px) {
  .auth-lang { top: 12px; inset-inline-end: 12px; }
  .auth-lang-item { padding: 3px 7px; font-size: 0.68rem; }
}

/* ── RTL ─────────────────────────────────────────────────────── */

/* The sign-in headline is start-aligned, which is left in English and right in
   Hebrew — `text-align: left` pinned it to the wrong edge under dir="rtl". */
.login-panel .auth-title {
  text-align: start;
}

/* The tagline is set in spaced small-caps, which is a Latin typographic device:
   Hebrew has no case, and letter-spacing pulls apart glyphs that are meant to
   connect visually. Render it plainly instead. */
[dir="rtl"] .auth-logo .tagline {
  letter-spacing: normal;
  text-transform: none;
  font-size: 0.72rem;
}

/* Email addresses and phone numbers stay LTR inside an RTL page — an address
   reordered right-to-left is unreadable and looks like a different address. */
[dir="rtl"] .auth-form input[type="email"],
[dir="rtl"] .auth-form input[type="tel"],
[dir="rtl"] .auth-form input[type="password"] {
  direction: ltr;
  text-align: start;
}
