/**
 * Auth pages — mobile-first responsive layout
 * Breakpoints: <768 stacked | 768–1199 split 50/50 | >=1200 split 55/45
 */

.cl-auth-page {
  --cl-auth-bg: #f3f5fb;
  --cl-auth-brand: #5f2ded;
  --cl-auth-radius-card: 16px;
  --cl-auth-radius-frame: 20px;
  --cl-auth-pad-inline: max(1rem, env(safe-area-inset-left, 0px));
  --cl-auth-pad-inline-end: max(1rem, env(safe-area-inset-right, 0px));
  --cl-auth-pad-block: max(0.75rem, env(safe-area-inset-top, 0px));
  --cl-auth-pad-block-end: max(1.25rem, env(safe-area-inset-bottom, 0px));
}

.cl-auth-body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(124, 58, 237, 0.12), transparent 38%),
    radial-gradient(circle at 90% 85%, rgba(59, 130, 246, 0.12), transparent 42%),
    var(--cl-auth-bg);
}

/* ---------- Mobile first: single column, no split ---------- */
.cl-auth-wrapper {
  box-sizing: border-box;
  width: 100%;
  min-height: 100svh;
  padding: var(--cl-auth-pad-block) var(--cl-auth-pad-inline) var(--cl-auth-pad-block-end);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.cl-auth-frame {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #e3e8f4;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  backdrop-filter: blur(6px);
  overflow-x: hidden;
}

.cl-auth-brand-panel {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(140deg, #5f2ded 0%, #6d28d9 50%, #7c3aed 100%);
  color: #fff;
  padding: 1rem 1rem 1.1rem;
}

.cl-brand-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  pointer-events: none;
}

.cl-brand-glow-top {
  width: 200px;
  height: 200px;
  top: -90px;
  right: -60px;
  background: rgba(255, 255, 255, 0.2);
}

.cl-brand-glow-bottom {
  width: 160px;
  height: 160px;
  left: -70px;
  bottom: -80px;
  background: rgba(56, 189, 248, 0.18);
}

.cl-brand-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

/* ---------- Official logo (SVG) ---------- */
.cl-brand-logo-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 0.35rem;
}

.cl-brand-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.cl-brand-logo--shell {
  padding: 0.28rem 0.42rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.14);
}

.cl-brand-logo__inner {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.auth-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

.auth-logo--brand-panel {
  max-width: min(200px, 78vw);
  max-height: 40px;
}

.auth-logo--compact-card {
  max-width: 168px;
  max-height: 40px;
}

.auth-logo--login-nav {
  max-width: min(176px, 50vw);
  max-height: 34px;
}

.auth-logo--header-bar {
  max-width: 132px;
  max-height: 30px;
}

.cl-brand-logo.login-dreams-logo-anchor {
  position: absolute;
  top: 2rem;
  left: 2.5rem;
  z-index: 3;
}

.login-dreams-mobile-logo {
  display: none;
  margin-bottom: 0.25rem;
  text-align: center;
}

@media (max-width: 768px) {
  .login-dreams-mobile-logo {
    display: block;
  }
}

.cl-brand-kicker {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.88;
}

.cl-brand-title {
  margin: 0.35rem 0 0.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.cl-brand-title__desktop {
  display: none;
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
}

.cl-brand-title__mobile {
  display: block;
  font-size: clamp(1.35rem, 5.2vw, 1.75rem);
}

.cl-brand-copy {
  margin: 0;
  max-width: 100%;
  line-height: 1.55;
  opacity: 0.92;
  overflow-wrap: break-word;
}

.cl-brand-copy__desktop {
  display: none;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
}

.cl-brand-copy__mobile {
  display: block;
  font-size: 0.875rem;
}

.cl-brand-list,
.cl-brand-trust {
  display: none;
}

.cl-brand-list {
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.65rem;
}

.cl-brand-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  backdrop-filter: blur(4px);
}

.cl-brand-list-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
}

.cl-brand-list h2 {
  margin: 0 0 0.1rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.cl-brand-list p {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.9;
  line-height: 1.45;
}

.cl-brand-trust {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.cl-brand-trust span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.88;
}

.cl-auth-form-panel {
  box-sizing: border-box;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.75rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.cl-auth-card {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  border-radius: var(--cl-auth-radius-card);
  border: 1px solid #e4e7ef;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  padding: 1rem 1rem 1.15rem;
}

.cl-auth-card-header {
  margin-bottom: 0.9rem;
}

.cl-auth-step {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5f2ded;
}

.cl-auth-card-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.25rem, 4.5vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cl-auth-card-header p {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.55;
}

.cl-auth-alert {
  display: none;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.6rem 0.7rem;
}

.cl-form-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

.cl-form-field {
  margin-bottom: 0.75rem;
}

.cl-form-field .form-label {
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.cl-auth-card .form-control,
.cl-auth-card .form-select {
  min-height: 48px;
  border: 1px solid #d7deea;
  border-radius: 11px;
  background: #fff;
  color: #0f172a;
  font-size: 16px;
  padding: 0.65rem 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.cl-auth-card .form-control::placeholder {
  color: #94a3b8;
}

.cl-auth-card .form-control:focus,
.cl-auth-card .form-select:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.cl-auth-card .form-control[aria-invalid="true"],
.cl-auth-card .form-select[aria-invalid="true"] {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Phone row: stack on narrow viewports */
.cl-otp-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.cl-phone-field {
  width: 100%;
  min-width: 0;
}

.cl-auth-card .input-with-prefix {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.cl-auth-card .input-with-prefix .prefix {
  flex: 0 0 auto;
  min-width: 4.25rem;
  border: 1px solid #d7deea;
  border-right: none;
  border-radius: 11px 0 0 11px;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
}

.cl-auth-card .input-with-prefix input,
.cl-auth-card .input-with-prefix .form-control {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 0 11px 11px 0;
}

.cl-otp-row .btn-cl-primary,
.cl-otp-row .btn-cl-outline,
.cl-otp-row .btn-cl-ghost {
  width: 100%;
  flex: 0 0 auto;
}

.cl-otp-section {
  display: none;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.cl-hint-text {
  display: none;
  margin-top: 0.4rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
}

.cl-dev-hint {
  display: none;
  margin-top: 0.45rem;
  border-radius: 9px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.78rem;
  padding: 0.5rem 0.6rem;
  gap: 0.4rem;
  align-items: center;
}

.cl-dev-hint strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.cl-success-chip {
  display: none;
  margin-bottom: 0.75rem;
  border-radius: 999px;
  background: #ecfdf3;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  align-items: center;
  gap: 0.3rem;
}

.cl-password-field {
  position: relative;
}

.cl-password-field .form-control {
  padding-right: 2.75rem;
}

.cl-password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #64748b;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.cl-password-toggle:hover {
  background: #f1f5f9;
  color: #334155;
}

.cl-password-toggle:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.cl-field-error {
  display: none;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #dc2626;
}

.cl-auth-meta {
  margin: 0.15rem 0 0.65rem;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.45;
}

.cl-register-cta {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9375rem;
}

.cl-auth-login-link {
  margin: 0.7rem 0 0;
  text-align: center;
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 600;
}

.cl-auth-login-link a {
  color: #5f2ded;
  text-decoration: none;
}

.cl-auth-login-link a:hover {
  text-decoration: underline;
}

.cl-auth-card .btn-cl-primary,
.cl-auth-card .btn-cl-outline,
.cl-auth-card .btn-cl-ghost {
  min-height: 48px;
  border-radius: 11px;
  font-size: 0.8125rem;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.cl-auth-card .btn-cl-primary:hover,
.cl-auth-card .btn-cl-outline:hover,
.cl-auth-card .btn-cl-ghost:hover {
  transform: translateY(-1px);
}

.cl-auth-card .btn-cl-primary:disabled,
.cl-auth-card .btn-cl-outline:disabled,
.cl-auth-card .btn-cl-ghost:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Tablet & up: split layout 50/50 ---------- */
@media (min-width: 768px) {
  .cl-auth-wrapper {
    min-height: 100vh;
    padding: 1rem var(--cl-auth-pad-inline) 1.25rem;
    justify-content: center;
  }

  .cl-auth-frame {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    max-width: min(1200px, 100%);
    border-radius: var(--cl-auth-radius-frame);
    border: 1px solid #e3e8f4;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.1);
    min-height: 0;
  }

  .cl-auth-brand-panel {
    flex: 1 1 50%;
    width: 50%;
    max-width: 50%;
    min-width: 0;
    padding: clamp(1.25rem, 2.2vw, 2rem);
    display: flex;
    flex-direction: column;
  }

  .cl-brand-glow-top {
    width: 280px;
    height: 280px;
    top: -110px;
    right: -80px;
  }

  .cl-brand-glow-bottom {
    width: 220px;
    height: 220px;
    left: -80px;
    bottom: -100px;
  }

  .cl-brand-content {
    flex: 1;
    gap: 0.5rem;
  }

  .cl-brand-title__mobile,
  .cl-brand-copy__mobile {
    display: none;
  }

  .cl-brand-title__desktop,
  .cl-brand-copy__desktop {
    display: block;
  }

  .cl-brand-list,
  .cl-brand-trust {
    display: grid;
  }

  .cl-brand-trust {
    display: flex;
    margin-top: auto;
    padding-top: 1rem;
    border-top: none;
  }

  .cl-brand-logo-row {
    justify-content: flex-start;
    margin-bottom: 0.45rem;
  }

  .auth-logo--brand-panel {
    max-width: min(260px, 40vw);
    max-height: 52px;
  }

  .auth-logo--login-nav {
    max-width: 200px;
    max-height: 38px;
  }

  .auth-logo--header-bar {
    max-width: 152px;
    max-height: 34px;
  }

  .cl-brand-kicker {
    font-size: 0.72rem;
  }

  .cl-auth-form-panel {
    flex: 1 1 50%;
    min-width: 0;
    width: 50%;
    max-width: 50%;
    padding: clamp(1rem, 2vw, 1.5rem);
    justify-content: center;
    align-items: stretch;
  }

  /* Tablet / narrow split: form uses full half-column width (no artificial narrow card) */
  .cl-auth-card {
    width: 100%;
    max-width: none;
    padding: clamp(1.1rem, 2vw, 1.5rem);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.09);
  }

  .cl-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
  }

  /* OTP: single row when space allows */
  .cl-otp-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
  }

  .cl-phone-field {
    flex: 1 1 0;
    min-width: 0;
  }

  .cl-otp-row .btn-cl-outline {
    flex: 0 0 auto;
    width: auto;
    min-width: 7.5rem;
  }

  .cl-otp-section .cl-otp-row {
    flex-wrap: nowrap;
  }

  .cl-otp-section .cl-otp-row .form-control {
    flex: 1 1 0;
    min-width: 0;
  }

  .cl-otp-section .cl-otp-row .btn-cl-primary {
    flex: 0 0 auto;
    width: auto;
    min-width: 7.5rem;
  }

  .cl-otp-section .cl-otp-row .btn-cl-ghost {
    flex: 0 0 auto;
    width: auto;
    min-width: 6.5rem;
  }
}

/* ---------- Desktop: 55 / 45 split + comfortable form card max-width ---------- */
@media (min-width: 1200px) {
  .cl-auth-frame {
    max-width: min(1240px, 100%);
  }

  .cl-auth-brand-panel {
    flex: 55 1 0;
    min-width: 0;
    width: 55%;
    max-width: 55%;
  }

  .cl-auth-form-panel {
    flex: 45 1 0;
    min-width: 0;
    width: 45%;
    max-width: 45%;
    align-items: center;
  }

  .cl-auth-card {
    max-width: min(520px, 100%);
    width: 100%;
  }

  .cl-brand-title__desktop {
    font-size: clamp(2rem, 2.6vw, 2.75rem);
  }

  .cl-brand-copy__desktop {
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    margin-bottom: 1rem;
  }

  .cl-brand-list {
    gap: 0.85rem;
  }

  .cl-brand-list li {
    padding: 0.75rem 0.85rem;
  }

  .auth-logo--brand-panel {
    max-width: min(300px, 36vw);
    max-height: 60px;
  }

  .auth-logo--header-bar {
    max-width: 168px;
    max-height: 36px;
  }
}

/* Narrow tablet: allow OTP row to wrap */
@media (min-width: 768px) and (max-width: 899.98px) {
  .cl-otp-row {
    flex-wrap: wrap;
  }

  .cl-phone-field {
    flex: 1 1 100%;
    min-width: 0;
  }

  .cl-otp-row .btn-cl-outline {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
  }
}
