/**
 * auth.css — Login Page & Auth UI Styles
 * Fusion Property Management — Batch 20
 *
 * Style reference: Fusion Command family (card-based, clean, premium operational).
 * Adapted for "Fusion PM" brand identity.
 * 
 * Design language:
 * - Centered card on soft off-white page background
 * - Deep navy logo mark (rounded square icon)
 * - Amber/gold accent underline beneath logo
 * - Toggle tabs for Sign In / Create Account
 * - Clean input fields with subtle border + shadow on focus
 * - Deep navy primary CTA button
 * - Light secondary links (Forgot password)
 */

/* ─── Auth page overlay ─────────────────────────────────────────────────── */

#auth-shell {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--color-bg, #f2f4f7);
  align-items: center;
  justify-content: center;
  font-family: var(--font-family, 'Inter', system-ui, sans-serif);
}

#auth-shell.auth-visible {
  display: flex;
}

/* ─── Card container ────────────────────────────────────────────────────── */

.auth-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #dde1ea);
  border-radius: 16px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 1px 3px rgba(30, 37, 64, 0.06),
    0 4px 16px rgba(30, 37, 64, 0.10),
    0 12px 40px rgba(30, 37, 64, 0.06);
}

/* ─── Brand area ────────────────────────────────────────────────────────── */

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.auth-logo-mark {
  width: 52px;
  height: 52px;
  background: var(--color-topbar-bg, #1e2540);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  position: relative;
}

/* Building icon inside logo mark */
.auth-logo-mark svg {
  width: 26px;
  height: 26px;
}

/* Amber accent underline beneath logo mark */
.auth-logo-mark::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: #d4a017;
  border-radius: 2px;
}

.auth-brand-name {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary, #1a1f2e);
  letter-spacing: -0.2px;
}

.auth-brand-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--color-text-muted, #8b92a5);
  font-weight: 400;
}

/* ─── Mode toggle (Sign In / Create Account) ────────────────────────────── */

.auth-mode-toggle {
  display: flex;
  background: var(--color-surface-raised, #f8f9fb);
  border: 1px solid var(--color-border, #dde1ea);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 24px;
  gap: 2px;
}

.auth-tab-btn {
  flex: 1;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-secondary, #52596e);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.auth-tab-btn:hover:not(.auth-tab-active) {
  background: var(--color-surface-hover, #f0f2f6);
  color: var(--color-text-primary, #1a1f2e);
}

.auth-tab-btn.auth-tab-active {
  background: var(--color-surface, #ffffff);
  color: var(--color-text-primary, #1a1f2e);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(30, 37, 64, 0.10);
}

/* ─── Form ──────────────────────────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.auth-field:last-of-type {
  margin-bottom: 0;
}

.auth-field-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.auth-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary, #1a1f2e);
  letter-spacing: 0.1px;
}

.auth-forgot-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-accent, #3b5bdb);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  transition: color 0.12s ease;
}

.auth-forgot-link:hover {
  color: var(--color-accent-hover, #2f4dc4);
  text-decoration: underline;
}

.auth-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text-primary, #1a1f2e);
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #dde1ea);
  border-radius: 7px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.auth-input::placeholder {
  color: var(--color-text-disabled, #bcc1cc);
  font-size: 13px;
}

.auth-input:focus {
  border-color: var(--color-accent, #3b5bdb);
  box-shadow: 0 0 0 3px var(--color-accent-subtle, rgba(59, 91, 219, 0.10));
}

.auth-input.auth-input-error {
  border-color: var(--color-danger, #c0392b);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}

/* ─── Error message ─────────────────────────────────────────────────────── */

.auth-error {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--color-danger-subtle, #fdecea);
  border: 1px solid rgba(192, 57, 43, 0.18);
  border-radius: 7px;
  font-size: 12px;
  color: var(--color-danger-text, #9e2f25);
  font-weight: 500;
  line-height: 1.4;
}

.auth-error.auth-error-visible {
  display: block;
}

/* ─── Success message ───────────────────────────────────────────────────── */

.auth-success {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--color-success-subtle, #e9f7f0);
  border: 1px solid rgba(42, 156, 94, 0.18);
  border-radius: 7px;
  font-size: 12px;
  color: var(--color-success-text, #1f7549);
  font-weight: 500;
  line-height: 1.4;
}

.auth-success.auth-success-visible {
  display: block;
}

/* ─── Primary CTA button ────────────────────────────────────────────────── */

.auth-btn-primary {
  margin-top: 20px;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.1px;
  color: #ffffff;
  background: var(--color-topbar-bg, #1e2540);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(30, 37, 64, 0.22);
}

.auth-btn-primary:hover:not(:disabled) {
  background: #252d50;
  box-shadow: 0 3px 12px rgba(30, 37, 64, 0.30);
}

.auth-btn-primary:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(30, 37, 64, 0.18);
}

.auth-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-btn-primary.auth-btn-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.auth-btn-primary.auth-btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.65s linear infinite;
}

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

/* ─── Footer ────────────────────────────────────────────────────────────── */

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-disabled, #bcc1cc);
}

/* ─── Transition: auth-shell → app-shell ────────────────────────────────── */

#app-shell {
  opacity: 0;
  transition: opacity 0.2s ease;
}

#app-shell.app-ready {
  opacity: 1;
}
