/* Entrance animations for the login/register split layout. Disabled
   entirely under prefers-reduced-motion (see bottom of file). */
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes authImgSettle {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

.auth-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 440px;
}
.auth-card--wide { max-width: 760px; }

.auth-card__brand { text-align: center; margin-bottom: 1.25rem; }
.auth-card__logo { font-size: 2.5rem; }
.auth-card__logo--img { width: 4rem; height: 4rem; object-fit: contain; margin: 0 auto; display: block; }
.auth-card__brand h1 { font-size: 1.4rem; }
.auth-card__tagline { color: var(--color-text-muted); margin: 0; font-size: 0.9rem; }

.auth-card__features {
  display: flex;
  justify-content: space-between;
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.auth-card__features span { display: block; font-size: 1.3rem; }

.auth-card__alt {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 1rem;
  animation: authFadeUp 0.6s ease 0.34s both;
}

.auth-footer {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-align: center;
  animation: authFadeIn 0.8s ease 0.4s both;
}

.auth-form { animation: authFadeUp 0.6s ease 0.26s both; }

.form-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.form-section legend {
  font-weight: 700;
  padding: 0 0.4rem;
  font-size: 1rem;
}

.field-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem 1rem; }

@media (min-width: 640px) {
  .field-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================================
   Split-screen auth layout (login / register): form on the left, a visual
   panel on the right. The visual panel is decorative -- it collapses below
   900px so phones (the majority of riders) get the full viewport for the
   form instead of competing with imagery.
   ========================================================================= */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.auth-shell__form-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem 1.5rem;
  gap: 1.5rem;
  /* Lighter than the page's pure-black background, so the form side doesn't
     read as harshly dark -- still the same dark theme family (this is the
     palette's "main surface" tone, same as cards). */
  background: var(--clr-darkest);
}

.auth-form-wrap {
  width: 100%;
  max-width: 420px;
}
.auth-form-wrap--wide { max-width: 760px; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
  animation: authFadeUp 0.6s ease both;
}
.auth-brand__logo {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  flex-shrink: 0;
}
.auth-brand__name { font-weight: 700; font-size: 1.65rem; letter-spacing: -0.01em; }

.auth-heading {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  animation: authFadeUp 0.6s ease 0.1s both;
}

@media (min-width: 900px) {
  .auth-brand__logo { width: 6.5rem; height: 6.5rem; }
  .auth-brand__name { font-size: 1.9rem; }
  .auth-heading { font-size: 2.75rem; }
}
.auth-subheading {
  color: var(--color-text-muted);
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  animation: authFadeUp 0.6s ease 0.18s both;
}

/* Modernized form controls used throughout the split layout. */
.auth-shell .field { margin-bottom: 1.1rem; }
.auth-shell input[type="text"],
.auth-shell input[type="email"],
.auth-shell input[type="password"],
.auth-shell input[type="tel"],
.auth-shell input[type="date"],
.auth-shell select {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: var(--clr-field);
  color: var(--clr-white);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.auth-shell input:focus,
.auth-shell select:focus {
  background: var(--clr-field-focus);
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(133, 102, 61, 0.25);
}

.auth-shell .btn--primary {
  border-radius: 12px;
  padding: 0.85rem 1.4rem;
  font-size: 1.02rem;
  box-shadow: 0 6px 16px rgba(133, 102, 61, 0.35);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.auth-shell .btn--primary:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(168, 132, 78, 0.4); }
.auth-shell .btn--primary:active { transform: translateY(0); }

.auth-shell .form-section {
  border-radius: 16px;
  border-color: var(--color-border);
}

/* --- Visual / placeholder panel --- */
.auth-shell__visual {
  display: none;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1), transparent 45%),
    linear-gradient(150deg, var(--clr-darkest) 0%, var(--clr-mid) 40%, var(--clr-gold) 75%, var(--clr-gold-light) 100%);
  color: var(--clr-white);
}
/* Swap in a real event photo by setting a background-image here (e.g. on a
   ::before layer with opacity + the gradient above as an overlay) once one
   is available -- the gradient + content below act as the placeholder. */
.auth-shell__visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.18) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  opacity: 0.5;
}

/* Photo variant (login): a real event photo fills the panel. Legibility
   comes from a floating translucent card behind the text (below), not from
   darkening the whole photo -- just a light overall scrim so the image
   stays clearly visible. */
.auth-shell__visual--photo::before { content: none; }
.auth-shell__visual-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: authImgSettle 1.4s ease-out both;
}
.auth-shell__visual--photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(38, 27, 14, 0.1);
}

.auth-shell__visual.auth-shell__visual--photo { display: none; }
@media (min-width: 900px) {
  .auth-shell__visual.auth-shell__visual--photo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
  }
}

/* The floating rectangle itself: a translucent, blurred card sized to the
   text so the photo remains visible around it, rather than a full-panel
   overlay. */
.auth-shell__visual--photo .auth-visual__content {
  position: relative;
  z-index: 1;
  display: block;
  height: auto;
  width: 100%;
  max-width: 440px;
  padding: 2.5rem 2.75rem;
  background: rgba(38, 27, 14, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(232, 213, 176, 0.2);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  animation: authCardIn 0.7s ease 0.25s both;
}

.auth-visual__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 4rem 3.5rem;
  max-width: 560px;
}
.auth-visual__icon {
  font-size: 3.5rem;
  display: inline-block;
  margin-bottom: 1.5rem;
}
.auth-visual__content h2 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.85rem;
}
.auth-visual__content p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 2rem;
  line-height: 1.6;
}

.auth-visual__features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.auth-visual__features li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
}

@media (min-width: 900px) {
  .auth-shell { flex-direction: row; }
  .auth-shell__form-area {
    flex: 0 0 50%;
    max-width: 640px;
    align-items: flex-start;
    /* flex-start (not center) is required here: combined with overflow-y,
       centering a flex column clips content taller than the viewport --
       you can scroll but never reach its top/bottom. margin:auto on the
       child below still centers it when it's short enough to fit. */
    justify-content: flex-start;
    padding: 3rem 4rem;
    overflow-y: auto;
    max-height: 100vh;
  }
  .auth-form-wrap { margin: auto 0; }
  .auth-shell__visual {
    display: block;
    flex: 1;
    position: sticky;
    top: 0;
    height: 100vh;
  }
}

@media (min-width: 1100px) {
  .auth-shell__form-area { flex-basis: 46%; padding: 3.5rem 5rem; }
}

/* Registration page: true 50/50 split between the form and the visual
   panel, rather than login's narrower, centered form column. */
@media (min-width: 900px) {
  .auth-shell--even .auth-shell__form-area {
    flex: 0 0 50%;
    max-width: none;
  }
}
@media (min-width: 1100px) {
  .auth-shell--even .auth-shell__form-area { flex-basis: 50%; padding: 3.5rem 4.5rem; }
}

/* =========================================================================
   Login splash screen: the right panel's photo, shown full-screen for a
   moment before the login form, every time the page loads.
   ========================================================================= */
@keyframes splashOut {
  to { opacity: 0; visibility: hidden; }
}

.login-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--clr-darkest);
  animation: splashOut 0.6s ease 1.3s forwards;
}
.login-splash__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: authImgSettle 1.6s ease-out both;
}
.login-splash__overlay {
  position: absolute;
  inset: 0;
  background: rgba(38, 27, 14, 0.55);
}
.login-splash__brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: authFadeUp 0.7s ease 0.15s both;
}
.login-splash__logo { width: 6rem; height: 6rem; object-fit: contain; }
.login-splash__name { color: var(--clr-white); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; }

@media (prefers-reduced-motion: reduce) {
  .auth-brand,
  .auth-heading,
  .auth-subheading,
  .auth-form,
  .auth-card__alt,
  .auth-footer,
  .auth-shell__visual-img,
  .auth-shell__visual--photo .auth-visual__content {
    animation: none;
  }
  /* Reduced motion: skip the splash outright rather than show it frozen. */
  .login-splash { display: none; }
}
