/* =========================
   AUTH (LOGIN / REGISTER)
========================= */
.auth-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 16px;
  background: var(--bg);
}

.auth-stack {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.auth-brand {
  width: 100%;
  text-align: center;
}

.auth-brand-title {
  margin: 0 0 8px 0;
  font-size: clamp(2.5rem, 6vw, 3.25rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.05;
}

.auth-brand-subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 500;
}

.auth-form {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-form input,
.auth-form select {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-form input::placeholder {
  color: var(--muted);
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.btn-primary,
.btn-secondary {
  width: 100%;
  height: 54px;
  border-radius: 12px;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  border: none;
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 16px;
}

.btn-secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-secondary:visited {
  color: var(--text);
}

.auth-footer {
  text-align: center;
  font-size: 0.96rem;
  color: var(--muted);
  margin-top: 4px;
}

.auth-footer a,
.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover,
.auth-link:hover {
  text-decoration: underline;
}

.auth-status {
  font-size: 0.9rem;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 0;
}

.auth-status.error {
  background: #fdf2f2;
  color: var(--danger);
  border: 1px solid var(--danger-line);
}

.auth-status.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #86efac;
}

.otp-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 4px 0 4px 0;
}

.otp-input {
  width: 48px;
  height: 58px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  outline: none;
  background: #fff;
  color: #101828;
}

.otp-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.trust-device-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-links-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.auth-link-inline {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
}

.auth-link-inline:hover {
  text-decoration: underline;
}

.auth-switch-text {
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
}

.auth-switch-text a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 700;
}

.auth-switch-text a:hover {
  text-decoration: underline;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px 0;
}

.twofa-qr-image {
  width: 220px;
  height: 220px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

/* Dark Theme Overrides */
:root.dark .auth-form {
  background: var(--panel);
  border-color: var(--line);
}
:root.dark .auth-form input,
:root.dark .auth-form select {
  background: #1d2230;
  border-color: var(--line);
  color: var(--text);
}
:root.dark .btn-secondary {
  background: #1b2130;
  border-color: var(--line);
  color: var(--text);
}
:root.dark .btn-secondary:hover {
  background: #232a3b;
  border-color: var(--accent);
}

/* Crema Theme Overrides */
:root.crema .auth-form {
  background: var(--panel);
  border-color: var(--line);
}
:root.crema .auth-form input,
:root.crema .auth-form select {
  background: #fff8ee;
  border-color: var(--line);
  color: var(--text);
}

/* Responsive */
@media (max-width: 640px) {
  .auth-container { padding: 28px 14px; }
  .auth-stack { gap: 18px; }
  .auth-form { padding: 24px 20px; gap: 16px; border-radius: 16px; }
  .row-2 { grid-template-columns: 1fr; gap: 14px; }
  .auth-brand-title { font-size: 2.35rem; }
  .auth-brand-subtitle { font-size: 1rem; }
  .auth-form input, .btn-primary, .btn-secondary { height: 52px; }
}

@media (max-width: 480px) {
  .auth-container, .auth-stack { padding: 24px 12px; }
}
