/* Auth pages (login / signup / verify-otp / forgot-password / reset-password).
   Styled to match the main SAGENT app: Manrope + Inter, cream background,
   gold accent, rounded white cards. Tokens come from css/tokens.css, which
   each page links first. Mirrors css/styles.css. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--secondary);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  padding: 3rem 2.5rem 2.5rem;
}

/* Brand wordmark — matches the sidebar logo in the main app. */
.auth-brand {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
  color: var(--red);
  line-height: 1;
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-header h1 {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1.6rem;
  color: var(--primary);
  margin: 0 0 0.5rem;
}

.auth-header p {
  color: #999;
  font-size: 0.9rem;
  margin: 0;
}

.auth-header strong {
  color: var(--text);
  font-weight: 600;
}

/* Messages */
.error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(232, 57, 42, 0.08);
  border: 1px solid rgba(232, 57, 42, 0.28);
  color: #B32A1E;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.info-message {
  background: rgba(39, 174, 96, 0.08);
  border: 1px solid rgba(39, 174, 96, 0.3);
  color: #1e7e4b;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group.items-end {
  align-items: flex-end;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: var(--primary);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.form-group input::placeholder {
  color: #bbb;
}

.form-group input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--gold-pale);
}

/* Password field + show/hide toggle */
.password-field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.password-field input {
  width: 100%;
  padding-right: 2.9rem;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  cursor: pointer;
  color: #bbb;
  transition: color 0.2s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--accent);
  outline: none;
}

/* OTP inputs */
.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.otp-input {
  width: 46px;
  height: 54px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.otp-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.resend-cooldown {
  color: #999;
  font-weight: 600;
}

/* Buttons */
.auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
}

.auth-button::after {
  content: "→";
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.auth-button:hover:not(:disabled) {
  background: var(--hover);
}

.auth-button:hover:not(:disabled)::after {
  transform: translateX(3px);
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* The arrow would compete with the spinner while a request is in flight. */
.auth-button:disabled::after {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

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

/* Footer + links */
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: #666;
}

.auth-footer p {
  margin: 0.5rem 0 0;
}

.auth-footer p:first-child {
  margin-top: 0;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.link-button:hover {
  color: var(--hover);
  text-decoration: underline;
}

/* ==========================================================================
   Onboarding (first-time tier / account-type selection)
   ========================================================================== */

.onboarding-card {
  max-width: 640px;
}

.onboarding-section {
  margin-bottom: 1.75rem;
}

.onboarding-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin: 0 0 0.75rem;
}

/* Account-type toggle (Firm / SMB) */
.account-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.account-type-option {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  padding: 1rem 1.25rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.account-type-option:hover {
  border-color: var(--accent);
}

.account-type-option.selected {
  border-color: var(--accent);
  background: var(--gold-pale);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.account-type-option .opt-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
  font-size: 0.95rem;
}

.account-type-option .opt-desc {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.25rem;
}

/* Tier cards */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 560px) {
  .tier-grid {
    grid-template-columns: 1fr;
  }
}

.tier-option {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  padding: 1.25rem 1rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.tier-option:hover {
  border-color: var(--accent);
}

.tier-option.selected {
  border-color: var(--accent);
  background: var(--gold-pale);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.tier-option .tier-name {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1.1rem;
  color: var(--primary);
}

.tier-option .tier-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}

.tier-option .tier-features {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: #777;
}

.tier-option .tier-features li {
  padding: 0.15rem 0;
}

.tier-option .tier-features li::before {
  content: '✓';
  color: var(--green);
  margin-right: 0.4rem;
}
