/* =====================================================================
   TrainMS — Shared auth styles (login, signup, forgot-password)
   Two-column shell, dark moving gradient bg, light card content.
   ===================================================================== */

:root {
  --bg: #08090d;
  --panel: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #5a5a5a;
  --ink-faint: #9a9a9a;
  --line: #e8e8e8;
  --line-strong: #d4d4d4;
  --accent: #1e4dd6;
  --accent-soft: #e9efff;
  --tint: #f5f5f5;
  --danger: #c83e3e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Animated dark gradient */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.06), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.04), transparent 50%),
    radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.03), transparent 45%),
    radial-gradient(circle at 30% 85%, rgba(255, 255, 255, 0.025), transparent 45%);
  filter: blur(50px);
  animation: drift 22s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(3%, -2%) scale(1.05); }
  100% { transform: translate(-2%, 3%) scale(1.02); }
}

/* --- Shell --------------------------------------------------- */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 30px 80px -40px rgba(0,0,0,0.45);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  min-height: 680px;
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeInUp {
  0%   { opacity: 0; transform: translateY(16px) scale(0.98); filter: blur(8px); }
  20%  { filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* --- Left panel (shared decorative frame) -------------------- */
.left {
  position: relative;
  padding: 32px;
  background: #fafafa;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
}
.brand-mark svg { width: 14px; height: 14px; }

.dot-field {
  position: absolute;
  inset: 90px -40px 180px 40px;
  background-image: radial-gradient(circle, #1a1a1a 1px, transparent 1.4px);
  background-size: 9px 9px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 55% 45%, black 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 55% 45%, black 30%, transparent 75%);
  opacity: 0.85;
  pointer-events: none;
}

.route-line {
  position: absolute;
  top: 130px;
  left: 60px;
  width: 60%;
  height: 80px;
  pointer-events: none;
}
.route-line svg { width: 100%; height: 100%; overflow: visible; }

.station-chip {
  position: absolute;
  top: 138px;
  left: 60px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 20px -12px rgba(0,0,0,0.15);
  z-index: 2;
}
.station-chip .dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.station-chip .code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.station-chip.end {
  top: 138px;
  left: auto;
  right: 32px;
}
.station-chip.end .dot { background: var(--ink); box-shadow: 0 0 0 3px #e5e5e5; }

.dot-band {
  position: absolute;
  bottom: 130px;
  left: 0; right: 0;
  height: 90px;
  background-image: radial-gradient(circle, #1a1a1a 1px, transparent 1.4px);
  background-size: 9px 9px;
  -webkit-mask-image: linear-gradient(180deg, transparent, black 40%, black 60%, transparent);
          mask-image: linear-gradient(180deg, transparent, black 40%, black 60%, transparent);
  opacity: 0.5;
}

.class-badge {
  position: absolute;
  right: 60px;
  bottom: 150px;
  background: white;
  border: 1px solid var(--line);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 17px;
  box-shadow: 0 8px 20px -12px rgba(0,0,0,0.15);
  z-index: 2;
}
.class-badge::before {
  content: '';
  position: absolute;
  right: 38px;
  top: 50%;
  width: 28px;
  height: 1.5px;
  background: var(--accent);
}

.tagline {
  margin-top: auto;
  z-index: 2;
}
.tagline h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.tagline h2 em {
  font-style: italic;
  font-weight: 400;
}

/* --- Feature card (used on both login & signup) -------------- */
.feature-card {
  position: relative;
  z-index: 3;
  margin: 130px 14px 0 auto;
  width: 78%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 40px -24px rgba(0,0,0,0.18);
}

.card-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.tab {
  font-size: 12px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  transition: all 0.18s ease;
}
.tab svg { width: 13px; height: 13px; }
.tab.active {
  color: var(--ink);
  background: linear-gradient(180deg, #eef2ff, #f7f9ff);
  border: 1px solid #dde4ff;
}
.tab:hover:not(.active) {
  background: var(--tint);
  color: var(--ink);
}
.tab:active { transform: scale(0.97); }

.card-view { animation: tabFade 0.25s ease-out; }
@keyframes tabFade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-body {
  font-size: 13px;
  line-height: 1.6;
  color: #3a3a3a;
  padding: 4px 2px 12px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}
.leg {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}
.leg b { color: var(--ink); font-weight: 600; }
.leg-arrow { color: var(--ink-faint); }

.pill-row {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pill {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
}
.pill svg { width: 11px; height: 11px; }

/* --- Right panel (forms) ------------------------------------ */
.right {
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.form-wrap { max-width: 360px; width: 100%; margin: 0 auto; }

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 28px;
}

label.field {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 14px;
  color: #1a1a1a;
}
label.field:first-of-type { margin-top: 0; }

.input-wrap {
  position: relative;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px #e5e5e5;
}
input::placeholder { color: var(--ink-faint); }

input.error, select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(200, 62, 62, 0.12);
}
.error-text {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 6px;
  min-height: 14px;
}

.toggle-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px;
}
.toggle-eye svg { width: 16px; height: 16px; display: block; }

.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 20px;
}
.forgot-link {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s;
}
.forgot-link:hover { color: var(--ink); text-decoration: underline; }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.2s;
}
.btn-primary:hover { background: #222; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #555; cursor: not-allowed; transform: none; }

.divider {
  text-align: center;
  color: var(--ink-faint);
  font-size: 12px;
  margin: 18px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--tint); }

/* --- Two-column form rows (signup) -------------------------- */
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.row-2 label.field { margin-top: 14px; }
.row-2 label.field:nth-child(-n+2) { margin-top: 0; }

/* --- Toast (polished version) ------------------------------- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

#toast-container .toast {
  min-width: 280px;
  max-width: 360px;
  margin-bottom: 10px;
  padding: 14px 16px 14px 18px;
  background: rgba(20, 20, 22, 0.92);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #f5f5f5;
  font-family: 'Inter', sans-serif;
  box-shadow:
    0 20px 50px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#toast-container .toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #888;
}
#toast-container .toast-success::before { background: #4ade80; }
#toast-container .toast-error::before   { background: #f87171; }
#toast-container .toast-warning::before { background: #fbbf24; }
#toast-container .toast-info::before    { background: #60a5fa; }

#toast-container .toast .toast-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
  letter-spacing: 0.01em;
}
#toast-container .toast-success .toast-title { color: #86efac; }
#toast-container .toast-error   .toast-title { color: #fca5a5; }
#toast-container .toast-warning .toast-title { color: #fcd34d; }
#toast-container .toast-info    .toast-title { color: #93c5fd; }

#toast-container .toast > div:last-child {
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(245, 245, 245, 0.85);
}

@keyframes toastSlideIn {
  0% { opacity: 0; transform: translateX(20px) scale(0.96); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* --- Responsive --------------------------------------------- */
@media (max-width: 900px) {
  body { padding: 16px; }
  .shell { grid-template-columns: 1fr; min-height: 0; }
  .left { display: none; }
  .right { padding: 40px 28px; }
  .row-2 { grid-template-columns: 1fr; gap: 0; }
  .row-2 label.field { margin-top: 14px; }
  .row-2 label.field:first-child { margin-top: 0; }
}