/* Interactive login / register */
.dash-auth {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 1rem 0 3rem;
  min-height: min(70vh, 640px);
  align-items: center;
}

.dash-auth__glow {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 90vw);
  height: 280px;
  background: radial-gradient(ellipse, var(--glow), transparent 70%);
  pointer-events: none;
  animation: auth-glow-pulse 6s ease-in-out infinite;
}

@keyframes auth-glow-pulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

.dash-auth__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  padding: 2rem 1.75rem 1.75rem;
  border-radius: 1.75rem;
  box-shadow:
    0 20px 50px color-mix(in srgb, var(--text) 12%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
  animation: auth-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dash-auth.is-leaving .dash-auth__card {
  animation: auth-card-out 0.4s ease forwards;
}

@keyframes auth-card-out {
  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
}

.dash-auth__greeting {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 0 0 0.35rem;
}

.dash-auth__motivation {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 1rem;
  padding-left: 0.65rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.dash-auth__title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  margin: 0 0 0.35rem;
  line-height: 1.15;
}

.dash-auth__sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

/* Tabs */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg);
  border-radius: 999px;
}

.auth-tabs__btn {
  position: relative;
  z-index: 1;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.25s ease;
}

.auth-tabs__btn[aria-selected="true"] {
  color: var(--text);
}

.auth-tabs__btn:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.auth-tabs__indicator {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: calc(50% - 0.25rem);
  height: calc(100% - 0.5rem);
  background: var(--surface);
  border-radius: 999px;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--text) 8%, transparent);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.auth-tabs[data-mode="register"] .auth-tabs__indicator {
  transform: translateX(100%);
}

/* Fields */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-field {
  position: relative;
  margin-bottom: 0.75rem;
}

/* Registration-only personal-details fields (hidden in sign-in mode). */
.auth-register-only { display: none; }
#auth-form[data-mode="register"] .auth-register-only { display: block; }

.auth-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.25rem 0 0.6rem;
}

.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.auth-field-row .auth-field { margin-bottom: 0.75rem; }

/* ---- Verify panel header ---- */
.verify-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.verify-header__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.875rem;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-strong);
  flex-shrink: 0;
}

.verify-header__icon svg { width: 1.35rem; height: 1.35rem; }

.verify-header__title {
  margin: 0 0 0.2rem !important;
  font-size: 1.35rem !important;
}

.verify-header__sub {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

/* ---- Verify channel picker ---- */
.verify-channels { margin-bottom: 1.25rem; }

.verify-channels__label {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.verify-channel-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.verify-channel-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.875rem;
  border: 2px solid color-mix(in srgb, var(--muted) 22%, transparent);
  border-radius: 1rem;
  background: var(--bg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-align: left;
  width: 100%;
}

.verify-channel-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--muted);
}

.verify-channel-btn__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.verify-channel-btn__type {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.verify-channel-btn__dest {
  font-size: 0.725rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verify-channel-btn.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.verify-channel-btn.is-active svg { color: var(--accent-strong); }
.verify-channel-btn.is-active .verify-channel-btn__type { color: var(--accent-strong); }
.verify-channel-btn.is-active .verify-channel-btn__dest { color: var(--text); }

.verify-channel-btn:hover:not(.is-active) {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

/* ---- Verify step indicator ---- */
.verify-step { margin-bottom: 0.75rem; }

.verify-step__label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

/* Text wrapper — allows flex to shrink & wrap long content */
.verify-step__text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Email / phone address inside the label — own line, highlighted */
.verify-step__text strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-strong);
  word-break: break-all;
  overflow-wrap: anywhere;
}

.verify-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  /* aligns circle top with first line of text */
  margin-top: 0.05rem;
}

/* reCAPTCHA inside the step — centred, never clips */
#recaptcha-container {
  display: flex;
  justify-content: center;
  margin: 0.25rem 0 0.5rem;
  overflow: hidden;
}
#recaptcha-container:empty { margin: 0; }

/* ---- Email verify panel ---- */

/* Spam hint below the OTP input */
.verify-email-spam {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

/* Verify status — override the section-label uppercase styling */
#verify-status {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent-strong);
  margin: 0.25rem 0 0.5rem;
  min-height: 1.1rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#verify-status:empty { display: none; }

.auth-field__icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-field__input {
  width: 100%;
  padding: 1rem 1rem 1rem 2.75rem;
  border: 2px solid color-mix(in srgb, var(--muted) 22%, transparent);
  border-radius: 1rem;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.auth-field__input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.auth-field:focus-within .auth-field__icon,
.auth-field.is-focused .auth-field__icon {
  color: var(--accent-strong);
}

.auth-field--password .auth-field__input {
  padding-right: 3rem;
}

.auth-field__toggle-pw {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.35rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-field__toggle-pw:hover {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.auth-field__toggle-pw svg {
  width: 1.15rem;
  height: 1.15rem;
}

.auth-error {
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: #b91c1c;
  margin: 0.25rem 0 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, #b91c1c 8%, transparent);
  transition: opacity 0.2s ease;
}

.auth-error:empty {
  display: none;
}

.auth-form.is-error {
  animation: auth-shake 0.45s ease;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.btn--block {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  position: relative;
  overflow: hidden;
}

.btn--block:disabled {
  opacity: 0.85;
  cursor: wait;
  transform: none;
}

.auth-submit__loader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-submit__loader.hidden,
.auth-submit__label.hidden {
  display: none;
}

.auth-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid color-mix(in srgb, #fff 35%, transparent);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-session-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 50vh;
  padding: 2rem 1.5rem;
  color: var(--muted);
}

.auth-session-loading.hidden {
  display: none;
}

.auth-session-loading .auth-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
}

.auth-session-loading__text {
  margin: 0;
  font-size: 0.9375rem;
}

.auth-footer {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.auth-footer__link {
  border: none;
  background: none;
  font-family: inherit;
  font-weight: 700;
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-footer__link:hover {
  color: var(--text);
}

/* Dashboard panel entrance */
#dashboard-panel.is-entering {
  animation: dash-panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dash-panel-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-auth__card,
  .dash-auth__glow,
  .auth-tabs__indicator,
  #dashboard-panel.is-entering {
    animation: none;
  }
  .auth-form.is-error {
    animation: none;
  }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   xs   < 360px   — tiny phones
   sm   360–479px — standard phones
   md   480–767px — large phones / small tablets
   lg   768–1023px — tablets
   xl   ≥ 1024px  — desktop (base styles)
   ============================================================ */

/* ---- Tablet (lg: 768–1023px) ---- */
@media (min-width: 768px) and (max-width: 1023px) {
  .dash-auth {
    padding: 2rem 1.5rem 3rem;
    min-height: min(65vh, 600px);
  }

  .dash-auth__card {
    max-width: 28rem;
    padding: 2rem 2rem 1.75rem;
  }
}

/* ---- Large phone / small tablet (md: 480–767px) ---- */
@media (max-width: 767px) {
  .dash-auth {
    padding: 1rem 1rem 2.5rem;
    align-items: flex-start;
    min-height: auto;
  }

  .dash-auth__card {
    border-radius: 1.5rem;
    padding: 1.75rem 1.5rem 1.5rem;
  }
}

/* ---- Standard phone (sm: 360–479px) ---- */
@media (max-width: 479px) {
  .dash-auth__card {
    border-radius: 1.25rem;
    padding: 1.5rem 1.125rem 1.25rem;
  }

  /* Stack the first/last name row */
  .auth-field-row {
    grid-template-columns: 1fr;
  }

  .verify-header { gap: 0.625rem; }
  .verify-header__icon { width: 2.25rem; height: 2.25rem; }
  .verify-header__title { font-size: 1.2rem !important; }

  /* Scale reCAPTCHA down to fit ~335px card interior.
     The widget is fixed at 304px; card inner width ≈ 335px so it fits,
     but we leave a tiny scale buffer for very compact viewports. */
  #recaptcha-container {
    transform-origin: center top;
    /* No scale needed yet — widget fits */
  }
}

/* ---- Tiny phone (xs: < 360px) ---- */
@media (max-width: 359px) {
  .dash-auth__card {
    border-radius: 1rem;
    padding: 1.25rem 1rem 1rem;
  }

  /* Single-column channel picker — each button fills the full width */
  .verify-channel-btns {
    grid-template-columns: 1fr;
  }

  /* Full width means no need to truncate */
  .verify-channel-btn__dest {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  /* Scale reCAPTCHA to fit inside a ~300px inner width.
     304px widget → scale ≈ 0.93 keeps it just inside the card. */
  #recaptcha-container {
    transform-origin: center top;
  }
  #recaptcha-container > div,
  #recaptcha-container iframe {
    transform: scale(0.93);
    transform-origin: center top;
  }
}

/* ── Profile photo gate ────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-photo-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.profile-photo-preview {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  border: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent-strong) 12%, transparent);
  overflow: hidden;
  position: relative;
}

.profile-photo-preview__placeholder {
  color: var(--accent-strong);
  display: grid;
  place-items: center;
}

.profile-photo-preview__placeholder svg {
  width: 2rem;
  height: 2rem;
}

.profile-photo-preview__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-photo-preview__img.hidden,
.profile-photo-preview__placeholder.hidden {
  display: none;
}

.profile-photo-note {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.75rem 0.9rem;
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text);
  background: color-mix(in srgb, #d68910 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #d68910 28%, transparent);
  border-radius: 0.85rem;
}

.profile-photo-note svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: #9a6307;
}

.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  width: 100%;
}

.profile-photo-pick {
  cursor: pointer;
  margin: 0;
}

.profile-photo-pick svg {
  width: 1rem;
  height: 1rem;
}

#profile-photo-continue:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
