/*
 * Auth pages use the same split layout and form shell, but this file keeps
 * login/register-specific spacing together instead of hiding it in shared.css.
 */

.auth-layout {
  align-items: stretch;
}

.auth-layout .hero h1 {
  max-width: 11ch;
}

.auth-layout .hero,
.auth-layout .form-shell {
  align-self: stretch;
}

.auth-single-layout {
  max-width: 34rem;
  margin: 0 auto;
}

.auth-page .shell-main {
  padding-top: 1.1rem;
}

.auth-page .form-shell {
  position: relative;
  overflow: hidden;
  padding: 1.55rem;
  border-radius: 24px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.09), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.96));
  box-shadow: 0 22px 42px -34px rgba(15, 23, 42, 0.32);
}

.auth-page .form-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.88), rgba(37, 99, 235, 0.16));
}

.auth-page .form-shell h2 {
  margin-bottom: 0.45rem;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.auth-page .form-shell form {
  display: grid;
  gap: 0.85rem;
}

.auth-page .btn[type="submit"] {
  position: relative;
  min-height: 3.7rem;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-page .btn[type="submit"]:hover {
  transform: translateY(-1px);
}

.auth-page .btn[type="submit"]:active {
  transform: translateY(1px) scale(0.99);
}

.auth-page .btn[type="submit"]:disabled {
  opacity: 0.8;
}

.auth-page .field {
  margin-bottom: 0;
}

.auth-switch-note {
  margin: 1rem 0 0;
  color: var(--muted);
  text-align: center;
}

.auth-switch-note a {
  color: var(--primary);
  font-weight: 600;
}

.auth-switch-note a:hover,
.auth-switch-note a:focus-visible {
  text-decoration: underline;
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 3.8rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease;
}

.password-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
}

.password-toggle-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--primary-dark);
  background: rgba(37, 99, 235, 0.08);
}

.codename-field {
  position: relative;
}

.codename-input {
  min-height: 3.3rem;
  padding-left: 3.5rem;
  padding-right: 3.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  border-radius: 14px;
}

.codename-help {
  display: block;
  margin-top: 0.55rem;
  line-height: 1.45;
}

.codename-refresh {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.codename-refresh:hover,
.codename-refresh:focus-visible {
  color: var(--primary-dark);
  text-decoration: underline;
}

.codename-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.codename-arrow-left {
  left: 0.55rem;
}

.codename-arrow-right {
  right: 0.55rem;
}

.codename-arrow:hover {
  transform: translateY(calc(-50% - 1px));
  background: rgba(37, 99, 235, 0.08);
}

.codename-arrow:focus-visible {
  background: rgba(37, 99, 235, 0.12);
}

.codename-actions,
.admin-mode-actions {
  margin-top: 0.85rem;
}

.auth-page .app-banner {
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(37, 99, 235, 0.06);
}

body.theme-dark.auth-page .form-shell {
  border-color: rgba(96, 165, 250, 0.16);
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.94));
  box-shadow: 0 22px 42px -34px rgba(2, 6, 23, 0.56);
}

body.theme-dark.auth-page .app-banner {
  border-color: rgba(96, 165, 250, 0.16);
  background: rgba(96, 165, 250, 0.08);
}

body.theme-dark.auth-page .password-toggle:hover,
body.theme-dark.auth-page .password-toggle:focus-visible,
body.theme-dark.auth-page .codename-arrow:hover,
body.theme-dark.auth-page .codename-arrow:focus-visible {
  background: rgba(96, 165, 250, 0.16);
}

@media (max-width: 640px) {
  .auth-page .shell-main {
    padding-top: 0.9rem;
  }

  .auth-page .form-shell {
    padding: 1.2rem;
    border-radius: 20px;
  }

  .auth-switch-note {
    margin-top: 0.9rem;
    font-size: 0.95rem;
  }

  .codename-arrow {
    width: 2.1rem;
    height: 2.1rem;
  }
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1.45;
}

.checkbox-label input {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  flex: 0 0 auto;
}

.legal-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 1.25rem;
  background-color: rgba(15, 23, 42, 0.68);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legal-modal-content {
  background-color: var(--card-bg, #fff);
  color: var(--text, #0f172a);
  border-radius: 18px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid rgba(37, 99, 235, 0.12);
  box-shadow: 0 28px 52px -36px rgba(15, 23, 42, 0.48);
}

.legal-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: var(--muted, #64748b);
  z-index: 10;
}

.legal-modal-close:hover {
  color: var(--primary-dark, #1d4ed8);
  background: rgba(37, 99, 235, 0.08);
}

.legal-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.legal-modal-body h1,
.legal-modal-body h2 {
  color: inherit;
}

.legal-modal-body p + h2 {
  margin-top: 1.2rem;
}

.legal-loading {
  text-align: center;
  padding: 2.5rem;
  color: var(--muted, #64748b);
}

@media (prefers-color-scheme: dark) {
  .legal-modal-content {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: rgba(96, 165, 250, 0.16);
  }

  .legal-modal-close {
    color: #cbd5e1;
  }

  .legal-modal-close:hover {
    color: #fff;
    background: rgba(96, 165, 250, 0.16);
  }
}

.legal-preview-link {
  background: none;
  border: none;
  color: var(--primary-color, #2c7da0);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  margin: 0;
}

.legal-preview-link:hover {
  color: var(--primary-dark, #1f5e7a);
}
