@import url("tokens.css?v=3");

.page-auth {
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.page-auth::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% -20%, rgba(56, 189, 248, 0.2), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 50%, rgba(125, 211, 252, 0.1), transparent 50%),
    radial-gradient(ellipse 40% 30% at 0% 80%, rgba(14, 165, 233, 0.08), transparent 45%);
}

.page-auth::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(125, 211, 252, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 252, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(100%, 440px);
  background: var(--surface);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg), var(--glow);
  animation: auth-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.auth-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border-strong);
  flex-shrink: 0;
}

.brand-tagline-auth {
  margin: 0.15rem 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 0.78rem;
  font-weight: 600;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), var(--accent-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-maintenance-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.45;
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.auth-maintenance-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
}

.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.auth-submit.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 1rem;
  background: #fff;
  color: #1f1f1f;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  text-decoration: none;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}

.auth-google-btn:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  border: 2px solid rgba(4, 16, 24, 0.2);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  vertical-align: -0.15em;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
  min-height: 0;
  margin: 0.25rem 0 0.5rem;
  max-width: 100%;
  overflow-x: auto;
}

.turnstile-wrap:empty {
  display: none;
}

.turnstile-config-error {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(252, 211, 77, 0.35);
  background: var(--warn-muted);
  color: var(--warn);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.otp-digit {
  width: 100%;
  aspect-ratio: 1;
  max-height: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-bright);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.otp-digit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  transform: translateY(-1px);
}

.otp-hint {
  margin: 0 0 0.75rem;
  text-align: center;
}

.otp-shake {
  animation: otp-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes otp-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.auth-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-bright);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  transition: color var(--transition-fast);
}

.auth-link-btn:hover:not(:disabled) {
  color: var(--accent);
}

.auth-link-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  text-decoration: none;
}

.meta-alert {
  animation: alert-in 0.3s ease both;
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .meta-alert,
  .otp-shake,
  .btn-spinner {
    animation: none !important;
  }

  .otp-digit:focus {
    transform: none;
  }
}

.auth-card--wizard {
  width: min(100%, 480px);
}

.auth-card--login {
  animation: auth-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-auth--register .auth-card {
  animation: auth-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-auth--login::before {
  animation: auth-glow-pulse 8s ease-in-out infinite alternate;
}

@keyframes auth-glow-pulse {
  from { opacity: 0.85; }
  to { opacity: 1; }
}

/* Wizard progress */
.auth-progress {
  margin-bottom: 1.25rem;
}

.auth-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.auth-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-progress-label {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

.auth-step-indicators {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-step-indicator {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  transition: color 0.3s ease;
}

.auth-step-indicator span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface-elevated);
  font-size: 0.75rem;
  font-weight: 700;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-step-indicator.is-active {
  color: var(--accent-bright);
}

.auth-step-indicator.is-active span {
  border-color: var(--accent);
  background: var(--accent-muted);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  transform: scale(1.05);
}

.auth-step-indicator.is-done {
  color: #34d399;
}

.auth-step-indicator.is-done span {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.12);
}

/* Wizard steps */
.auth-step {
  display: grid;
  gap: 1rem;
  animation: step-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-step.is-hidden {
  display: none;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.auth-step-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.auth-step-actions .btn-primary {
  grid-column: 2;
}

/* Animated fields */
.field--animated {
  position: relative;
}

.field--animated input {
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.field--animated input:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.12);
}

.field--animated .hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Password field with visibility toggle */
.field--password .field-password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.field--password .field-password-wrap input {
  width: 100%;
  padding-right: 2.75rem;
}

.pwd-toggle-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.pwd-toggle-btn:hover {
  color: var(--accent-bright);
  background: rgba(125, 211, 252, 0.08);
}

.pwd-toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-muted);
}

.pwd-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.pwd-mismatch {
  margin: -0.35rem 0 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  font-size: 0.82rem;
  font-weight: 600;
  animation: alert-in 0.25s ease both;
}

.field--password input.input--warn {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}

/* Password strength */
.pwd-strength {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  animation: pwd-in 0.35s ease both;
}

@keyframes pwd-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pwd-strength-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pwd-strength-head strong {
  font-weight: 700;
  transition: color 0.25s ease;
}

.pwd-strength-head strong[data-level="weak"] { color: #f87171; }
.pwd-strength-head strong[data-level="fair"] { color: #fbbf24; }
.pwd-strength-head strong[data-level="strong"] { color: #34d399; }
.pwd-strength-head strong[data-level="empty"] { color: var(--text-dim); }

.pwd-strength-track {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-elevated);
  overflow: hidden;
}

.pwd-strength-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

.pwd-strength-bar[data-level="weak"] { background: linear-gradient(90deg, #f87171, #ef4444); }
.pwd-strength-bar[data-level="fair"] { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.pwd-strength-bar[data-level="strong"] { background: linear-gradient(90deg, #34d399, #10b981); }
.pwd-strength-bar[data-level="empty"] { background: var(--border); }

.pwd-checklist {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.pwd-rule {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  transition: color 0.25s ease;
}

.pwd-rule::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.pwd-rule--ok {
  color: #34d399;
}

.pwd-rule--ok::before {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.2);
  transform: scale(1.05);
  box-shadow: inset 0 0 0 2px #34d399;
}

/* Login extras */
.auth-forgot-row {
  margin: -0.35rem 0 0;
  text-align: right;
}

.auth-forgot-row a {
  font-size: 0.82rem;
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.auth-forgot-row a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .page-auth--login::before,
  .auth-step,
  .pwd-strength,
  .auth-progress-bar,
  .field--animated input:focus {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

.auth-switch {
  margin: 1.25rem 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.auth-switch a {
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.auth-switch a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.sidebar-user {
  padding: 0.75rem 1rem 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-user-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar-user-email {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.sidebar-logout {
  font-size: 0.78rem;
  color: var(--accent-bright);
}

.auth-card--wide {
  max-width: 720px;
}

.terms-clickwrap {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.terms-clickwrap input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.terms-clickwrap a {
  color: var(--accent-bright);
  text-decoration: underline;
}

.terms-hint {
  margin: 0 0 1rem;
}

.terms-docs-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1rem 0;
}

.terms-doc-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.terms-doc-status.done {
  color: #34d399;
}

.page-legal-doc .legal-doc-shell {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

.legal-doc-content {
  max-height: 80vh;
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-elevated);
}

.legal-doc-footer {
  margin-top: 0.75rem;
}

/* ── Responsivo ── */
@media (max-width: 480px) {
  .auth-shell {
    padding: 1rem 0.75rem;
  }

  .auth-card,
  .auth-card--wizard,
  .auth-card--wide {
    padding: 1.35rem 1.15rem;
    border-radius: var(--radius-lg);
  }

  .auth-card h1 {
    font-size: 1.3rem;
  }

  .auth-step-indicators {
    gap: 0.2rem;
  }

  .auth-step-indicator {
    font-size: 0;
  }

  .auth-step-indicator span {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .auth-step-actions {
    grid-template-columns: 1fr;
  }

  .auth-step-actions .btn-primary {
    grid-column: 1;
  }

  .otp-inputs {
    gap: 0.35rem;
  }

  .otp-digit {
    font-size: 1.1rem;
    max-height: 48px;
  }

  .terms-doc-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .page-legal-doc .legal-doc-shell {
    margin: 1rem auto;
    padding: 0 0.75rem;
  }
}

@media (max-width: 400px) {
  .otp-digit {
    font-size: 1rem;
    max-height: 42px;
  }
}


.legal-doc-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.legal-doc-content img,
.legal-doc-content video,
.legal-doc-content iframe {
  max-width: 100%;
  height: auto;
}

.legal-doc-content pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.manager-legal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.manager-legal-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.manager-legal-tab.active {
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(125, 211, 252, 0.1);
}

.manager-status-banned {
  color: #f87171;
  font-weight: 600;
}
