/* WP SAAS MOD - User Auth styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --auth-primary: #F97316;
  --auth-primary-contrast: #ffffff;
  --auth-secondary: #1E293B;
  --auth-font-heading: 'Plus Jakarta Sans', sans-serif;
  --auth-font-body: 'Inter', sans-serif;
  --auth-gray-50: #F8FAFC;
  --auth-gray-100: #F1F5F9;
  --auth-gray-200: #E2E8F0;
  --auth-gray-300: #CBD5E1;
  --auth-gray-400: #94A3B8;
  --auth-gray-500: #64748B;
  --auth-gray-900: #0F172A;
  --auth-radius: 10px;
  --auth-radius-btn: 10px;
}

html { height: 100%; }

body.saas-auth-page {
  min-height: 100vh;
  background: #ffffff;
  font-family: var(--auth-font-body);
  color: var(--auth-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ─── Container ─── */
.auth-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 0;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  background: #ffffff;
  border: 1px solid var(--auth-gray-100);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  padding: 36px 32px;
}

/* ─── Logo ─── */
.auth-logo {
  margin-bottom: 20px;
}

.auth-logo-img {
  max-width: 100%;
  border-radius: 14px;
  object-fit: contain;
  display: block;
}

.auth-logo-fallback {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--auth-primary);
  color: #fff;
  font-family: var(--auth-font-heading);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Headings ─── */
.auth-title {
  font-family: var(--auth-font-heading);
  font-size: 26px;
  font-weight: 700;
  color: var(--auth-secondary);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--auth-gray-500);
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ─── Form ─── */
.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

/* Honeypot - visually hidden but present in the DOM, tab-order-free */
.auth-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-secondary);
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--auth-gray-200);
  border-radius: var(--auth-radius);
  font-family: var(--auth-font-body);
  font-size: 16px;
  color: var(--auth-secondary);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}

.auth-field input:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-primary) 15%, transparent);
}

.auth-field input.error {
  border-color: #ef4444;
}

.auth-hint {
  font-size: 12px;
  color: var(--auth-gray-400);
  margin-top: 2px;
}

/* Two-column field row */
.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Row with checkbox + link */
.auth-field--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--auth-gray-500);
  cursor: pointer;
}

.auth-checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--auth-gray-300);
  border-radius: 5px;
  background: #ffffff;
  position: relative;
  cursor: pointer;
}

.auth-checkbox-label input[type="checkbox"]:checked {
  background: var(--auth-primary);
  border-color: var(--auth-primary);
}

.auth-checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--auth-primary-contrast);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / 78% 78%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / 78% 78%;
}

.auth-checkbox-label input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
}

/* Password input wrapper */
.auth-input-wrap {
  position: relative;
}

.auth-input-wrap input {
  padding-right: 44px;
}

.auth-toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--auth-gray-400);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.auth-toggle-pw:hover { color: var(--auth-secondary); }

/* Code input */
input[name="code"] {
  letter-spacing: 6px;
  font-size: 22px !important;
  font-weight: 700;
  text-align: center;
}

input[name="code"]::placeholder {
  color: var(--auth-gray-300);
  font-weight: 400;
  letter-spacing: 10px;
  opacity: 1; /* Firefox dims placeholders by default */
}

/* ─── Button ─── */
.auth-btn {
  width: 100%;
  height: 50px;
  background: var(--auth-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--auth-radius-btn);
  font-family: var(--auth-font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.auth-btn:hover { opacity: 0.9; }
.auth-btn:active { transform: scale(0.99); }
.auth-btn:disabled { opacity: 0.65; cursor: not-allowed; }

a.auth-btn { text-decoration: none; }

.auth-toggle-pw,
.auth-link,
.auth-link-btn {
  transition: color 0.15s ease;
}

/* ─── Spinner ─── */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: saas-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ─── Provider mode banner ─── */
.auth-mode-banner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--auth-primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--auth-primary) 25%, transparent);
  color: var(--auth-primary);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  animation: saas-banner-in 0.35s ease;
}

.auth-mode-banner svg {
  flex-shrink: 0;
}

.auth-mode-banner strong {
  font-weight: 700;
}

@keyframes saas-banner-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Role switch ─── */
.auth-role-switch {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: var(--auth-radius);
  background: var(--auth-gray-50);
  border: 1px dashed var(--auth-gray-200);
  text-align: center;
}

.auth-role-switch span {
  font-size: 13.5px;
  color: var(--auth-gray-500);
}

.auth-role-switch-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-primary);
  text-decoration: none;
}

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

.auth-role-switch-link svg { transition: transform 0.15s ease; }

.auth-role-switch-link:hover svg { transform: translateX(2px); }

/* ─── Alert ─── */
.auth-alert {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.auth-alert--error {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.auth-alert--success {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

.auth-notice {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.auth-notice--success {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

.auth-disclaimer {
  font-size: 12px;
  color: var(--auth-gray-400);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-disclaimer a {
  color: var(--auth-primary);
  font-weight: 400;
  text-decoration: underline;
}

/* ─── Footer text ─── */
.auth-footer-text {
  font-size: 14px;
  color: var(--auth-gray-500);
  text-align: center;
}

.auth-link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
}

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

.auth-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--auth-font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-primary);
  cursor: pointer;
}

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

/* ─── Responsive ─── */
@media (max-width: 520px) {
  body.saas-auth-page { padding: 20px 16px; align-items: flex-start; }
  .auth-container { padding: 16px 0; }
  .auth-card { padding: 24px 20px; border-radius: 14px; box-shadow: none; border: none; }
  .auth-title { font-size: 22px; }
  .auth-field-row { grid-template-columns: 1fr; gap: 18px; }
}
