/* ==========================================================
   Auth pages (login / register)
   Self-contained: does not rely on Bootstrap utility classes.
   ========================================================== */

.auth-page {
  --a-navy: var(--dark-color, #15161D);
  --a-navy-2: var(--dark-secondary, #1E1F29);
  --a-accent: var(--primary-color, #D10024);
  --a-accent-dark: var(--primary-hover, #B3001F);
  --a-ink: var(--heading-color, #2B2D42);
  --a-muted: var(--gray-500, #6B7280);
  --a-line: var(--border-color, #E4E7ED);
  --a-line-strong: var(--gray-300, #D1D5DB);
  --a-surface: var(--white, #FFFFFF);
  --a-bg: var(--slate-100-soft, #F5F7FA);
  --a-danger: var(--danger-crimson, #B91C1C);
  --a-danger-bg: #FEF3F2;
  --a-danger-line: #FECDCA;

  box-sizing: border-box;
  min-height: 60vh;
  padding: 3rem 1rem 4rem;
  background: var(--a-bg);
  font-family: inherit;
  color: var(--a-ink);
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
  box-sizing: border-box;
}

/* ---------- Shell: two panels ---------- */

.auth-shell {
  display: grid;
  grid-template-columns: 5fr 6fr;
  max-width: 900px;
  margin: 0 auto;
  background: var(--a-surface);
  border: 1px solid var(--a-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px -20px rgba(15, 23, 42, 0.25);
}

/* ---------- Left panel ---------- */

.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 2.75rem 2.25rem;
  color: #fff;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(209, 0, 36, 0.40) 0%, rgba(209, 0, 36, 0) 60%),
    var(--a-navy);
}

.auth-aside-title {
  margin: 0 0 0.6rem;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.auth-aside-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: #b8c4da;
}

.auth-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.auth-perks li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.92rem;
  color: #e2e8f5;
}

.auth-perks svg {
  flex-shrink: 0;
  box-sizing: content-box;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.09);
  color: #ff8fa3;
}

/* ---------- Right panel ---------- */

.auth-main {
  padding: 2.75rem 2.5rem 2.25rem;
}

.auth-card-head {
  margin-bottom: 1.75rem;
}

.auth-title {
  margin: 0 0 0.4rem;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--a-ink);
}

.auth-subtitle {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--a-muted);
  max-width: 38ch;
}

/* ---------- Error alert ---------- */

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--a-danger);
  background: var(--a-danger-bg);
  border: 1px solid var(--a-danger-line);
  border-radius: 10px;
}

.auth-alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---------- Google button + divider (from partial) ---------- */

.auth-google-wrap {
  margin-bottom: 0;
}

.btn-google-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  height: 48px;
  padding: 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--a-ink);
  background: var(--a-surface);
  border: 1.5px solid var(--a-line);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-google-auth:hover {
  background: #f8fafc;
  border-color: var(--a-line-strong);
  color: var(--a-ink);
}

.btn-google-auth:focus-visible {
  outline: 3px solid rgba(209, 0, 36, 0.30);
  outline-offset: 2px;
}

.btn-google-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.4rem 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--a-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--a-line);
}

/* ---------- Form ---------- */

.auth-form {
  display: grid;
  gap: 1.1rem;
}

.auth-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--a-ink);
}

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

.auth-link-small {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--a-accent);
  text-decoration: none;
}

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

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: #8a97ad;
  pointer-events: none;
  transition: color 0.15s ease;
}

.auth-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px 0 44px;
  font: inherit;
  font-size: 1rem;
  color: var(--a-ink);
  background: #fff;
  border: 1.5px solid var(--a-line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
  color: #9aa6ba;
}

.auth-input:hover {
  border-color: var(--a-line-strong);
}

.auth-input:focus {
  border-color: var(--a-accent);
  box-shadow: 0 0 0 4px rgba(209, 0, 36, 0.12);
}

.auth-input-wrap:focus-within .auth-input-icon {
  color: var(--a-accent);
}

/* Browser autofill: keep it on-brand instead of the default yellow/blue */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--a-ink);
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 9999s ease-out;
}

.auth-input--has-toggle {
  padding-right: 48px;
}

/* ---------- Show / hide password ---------- */

.auth-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #8a97ad;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.auth-toggle:hover {
  color: var(--a-ink);
  background: #f1f5f9;
}

.auth-toggle:focus-visible {
  outline: 3px solid rgba(209, 0, 36, 0.30);
}

.auth-toggle .icon-hide { display: none; }
.auth-toggle.is-visible .icon-show { display: none; }
.auth-toggle.is-visible .icon-hide { display: block; }

/* ---------- Submit ---------- */

.auth-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  margin-top: 0.35rem;
  padding: 0 1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--a-accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.auth-submit:hover {
  background: var(--a-accent-dark);
}

.auth-submit:active {
  transform: translateY(1px);
}

.auth-submit:focus-visible {
  outline: 3px solid rgba(209, 0, 36, 0.35);
  outline-offset: 2px;
}

.auth-submit:disabled {
  cursor: progress;
  background: var(--a-accent-dark);
}

.auth-spinner {
  display: none;
  width: 18px;
  height: 18px;
  margin-left: 0.6rem;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.auth-submit.is-loading .auth-spinner {
  display: inline-block;
}

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

/* ---------- Field validation (register) ---------- */

.auth-input.is-invalid,
.auth-input.is-invalid:hover {
  border-color: var(--a-danger);
}

.auth-input.is-invalid:focus {
  border-color: var(--a-danger);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.14);
}

.auth-field-error {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--a-danger);
}

.auth-field-error[hidden] {
  display: none;
}

/* ---------- Footer ---------- */

.auth-footer-text {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--a-muted);
}

.auth-footer-text a {
  margin-left: 0.2rem;
  font-weight: 600;
  color: var(--a-accent);
  text-decoration: none;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .auth-page {
    padding: 1.5rem 1rem 3rem;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 440px;
  }

  .auth-aside {
    display: none;
  }

  .auth-main {
    padding: 2rem 1.5rem 1.75rem;
  }

  .auth-title {
    font-size: 1.6rem;
  }

  /* 16px inputs stop iOS Safari from zooming on focus */
  .auth-input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner {
    animation-duration: 1.6s;
  }

  .auth-input,
  .auth-submit,
  .btn-google-auth {
    transition: none;
  }
}
