/* =====================================================================
   QuizRacer 2D - Giao diện trang Đăng nhập (Pixel Art + Retro Racing + Pastel)
   Chỉ dùng bởi Views/Shared/_LoginLayout.cshtml + Views/Account/Login.cshtml.
   Tiền tố: ql-  (các class qr-* chỉ được định nghĩa lại trong phạm vi .ql-card)
   ===================================================================== */
:root {
  --ql-ink: #1f1b3a;
  --ql-cream: #fff8ec;
  --ql-coral: #ff9f8a;
  --ql-coral-d: #ff8a73;
  --ql-mint: #a9ecd3;
  --ql-pink: #ff6fa5;
  --ql-butter: #ffe88f;
  --ql-sky: #bfe0ff;
  --ql-road: #cdd3f0;
  --ql-focus: #6c5ce7;
  --ql-font-head: "Baloo 2", "Nunito", "Segoe UI", system-ui, sans-serif;
  --ql-font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.ql-body {
  margin: 0; min-height: 100vh;
  font-family: var(--ql-font); color: var(--ql-ink);
  background-color: var(--ql-cream);
  background-image: radial-gradient(rgba(31, 27, 58, .16) 1.4px, transparent 1.4px);
  background-size: 18px 18px;
}

.ql-wrap {
  position: relative; min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 56px 14px 40px;
  overflow-x: hidden; overflow-x: clip;
}

/* ---------- Nền trang trí ---------- */
.ql-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.ql-deco { position: absolute; border: 3px solid var(--ql-ink); animation: ql-float 7s ease-in-out infinite; }
.ql-deco.sun { width: 120px; height: 120px; border-radius: 50%; background: var(--ql-butter); top: -34px; left: -34px; }
.ql-deco.sq-blue { width: 64px; height: 64px; border-radius: 18px; background: var(--ql-sky); top: 38%; left: 8%; --r: -12deg; animation-delay: -3s; }
.ql-deco.sq-mint { width: 70px; height: 70px; border-radius: 20px; background: var(--ql-mint); top: 14%; right: 12%; --r: 12deg; animation-delay: -1s; }
.ql-deco.circ-pink { width: 100px; height: 100px; border-radius: 50%; background: #ffb8cf; top: 30%; right: -34px; animation-delay: -4s; }
.ql-deco.circ-pink2 { width: 70px; height: 70px; border-radius: 50%; background: #ffb8cf; bottom: -20px; left: 36%; animation-delay: -2s; }

.ql-cloud { position: absolute; height: auto; image-rendering: pixelated; animation: ql-drift linear infinite; }
.ql-cloud.c1 { top: 7%; left: 0; width: 100px; animation-duration: 75s; animation-delay: -20s; }
.ql-cloud.c2 { top: 21%; left: 0; width: 78px; animation-duration: 98s; animation-delay: -65s; }
.ql-cloud.c3 { top: 12%; left: 0; width: 90px; animation-duration: 84s; animation-delay: -40s; }

.ql-prop { position: absolute; image-rendering: pixelated; height: auto; }
.ql-prop.star { width: 52px; left: 4%; bottom: 6%; animation: ql-wiggle 4s ease-in-out infinite; }
.ql-prop.trophy { width: 56px; right: 4%; bottom: 5%; animation: ql-wiggle 5s ease-in-out -2s infinite; }
.ql-prop.coin { width: 40px; left: 22%; top: 12%; animation: ql-float 6s ease-in-out -1s infinite; }
.ql-spark { position: absolute; width: 22px; height: auto; image-rendering: pixelated; animation: ql-twinkle 2.6s ease-in-out infinite; }
.ql-spark.s1 { top: 26%; left: 15%; }
.ql-spark.s2 { top: 8%; right: 30%; animation-delay: -.9s; width: 18px; }
.ql-spark.s3 { top: 55%; right: 9%; animation-delay: -1.7s; }

/* Đường đua nằm ngang phía sau khung đăng nhập */
.ql-road {
  position: absolute; left: 0; right: 0; bottom: 20%; height: 92px;
  background: var(--ql-road); border-top: 3px solid var(--ql-ink); border-bottom: 3px solid var(--ql-ink);
  overflow: hidden;
}
.ql-road::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px;
  background: linear-gradient(90deg, #fff 50%, transparent 50%) 0 0 / 56px 4px repeat-x;
  animation: ql-lane 1s linear infinite;
}
.ql-car { position: absolute; left: 0; width: 84px; height: auto; image-rendering: pixelated; will-change: transform; }
.ql-car.c1 { top: 6px; animation: ql-drive 13s linear infinite; animation-delay: -4s; }
.ql-car.c2 { bottom: 6px; animation: ql-drive 9s linear infinite; animation-delay: -7s; }
.ql-car.c3 { top: 6px; animation: ql-drive 17s linear infinite; animation-delay: -12s; }
.ql-car.c4 { bottom: 6px; animation: ql-drive 15s linear infinite; animation-delay: -1s; }
.ql-flag { position: absolute; bottom: 4px; width: 56px; height: auto; image-rendering: pixelated; }
.ql-flag.l { left: calc(50% - 255px); }
.ql-flag.r { right: calc(50% - 255px); }

@keyframes ql-float { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-10px) rotate(var(--r, 0deg)); } }
@keyframes ql-wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) translateY(-4px); } }
@keyframes ql-twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes ql-drift { from { transform: translateX(-140px); } to { transform: translateX(calc(100vw + 140px)); } }
@keyframes ql-drive { from { transform: translateX(-120px); } to { transform: translateX(calc(100vw + 40px)); } }
@keyframes ql-lane { to { background-position: -56px 0; } }
@keyframes ql-bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }

/* ---------- Khung đăng nhập ---------- */
.ql-card.qr-card {
  position: relative; z-index: 2;
  width: 100%; max-width: 420px;
  padding: 42px 28px 24px;
  background: linear-gradient(90deg, var(--ql-coral) 0%, #e6f0cf 52%, var(--ql-mint) 100%);
  border: 3px solid var(--ql-ink); border-radius: 25px;
  box-shadow: 8px 8px 0 var(--ql-ink);
  margin-top: 18px;
}
.ql-hero-car {
  position: absolute; left: 50%; top: -29px; width: 92px; height: auto;
  image-rendering: pixelated; transform: translateX(-50%);
  animation: ql-bob 2.4s ease-in-out infinite;
}
.ql-title.qr-title {
  display: flex; align-items: center; justify-content: center; gap: 0;
  font-family: var(--ql-font-head); font-weight: 800; font-size: 2.3rem; line-height: 1.05;
  color: var(--ql-ink); margin: 0; letter-spacing: -.5px;
}
.ql-title.qr-title span { color: var(--ql-pink); }
.ql-sub.qr-sub { color: var(--ql-ink); font-weight: 700; font-size: .95rem; margin: 2px 0 16px; }

/* ---------- Thông báo ---------- */
.ql-card .qr-alert { border: 2px solid var(--ql-ink); border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: .9rem; }
.ql-card .qr-alert.ok { background: rgba(255, 255, 255, .6); color: var(--ql-ink); }
.ql-card .qr-alert.bad { background: #ffe0e6; color: #a8203f; }
.ql-card .validation-summary-errors {
  background: #ffe0e6; border: 2px solid var(--ql-ink); color: #a8203f; border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: .9rem;
}
.ql-card .validation-summary-valid { display: none; }
.ql-card .qr-error, .ql-card .field-validation-error {
  display: block; margin-top: 4px; color: #b01f45; font-weight: 800; font-size: .82rem;
}

/* ---------- Ô nhập liệu ---------- */
.ql-card .qr-label { display: block; font-weight: 800; font-size: .9rem; color: var(--ql-ink); margin-bottom: 4px; }
.ql-card .qr-input.form-control {
  min-height: 46px; padding: 9px 14px;
  font-family: var(--ql-font); font-weight: 600; font-size: 1rem; color: var(--ql-ink);
  background: #fff; border: 3px solid var(--ql-ink); border-radius: 14px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ql-card .qr-input.form-control::placeholder { color: #8f89ab; font-weight: 600; }
.ql-card .qr-input.form-control:focus {
  outline: none; border-color: var(--ql-ink); background: #fff;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ql-focus);
  transform: translateY(-1px);
}
.ql-card .qr-input.input-validation-error { border-color: #d6314f; background: #fff7f8; }
.ql-card .qr-pw .qr-input { padding-right: 52px; }
.ql-card .qr-pw button {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ql-ink); background: transparent; border: 0; border-radius: 10px; cursor: pointer;
  transition: background-color .12s ease;
}
.ql-card .qr-pw button:hover { background: var(--ql-butter); }
.ql-card .qr-pw button:focus-visible { outline: 3px solid var(--ql-focus); outline-offset: 1px; }

/* ---------- Checkbox ---------- */
.ql-check.form-check { display: flex; align-items: center; gap: 8px; padding-left: 0; min-height: 1.5rem; }
.ql-check .form-check-input {
  float: none; margin: 0; flex: 0 0 22px; width: 22px; height: 22px;
  border: 3px solid var(--ql-ink); border-radius: 7px; background-color: #fff; cursor: pointer;
}
.ql-check .form-check-input:checked { background-color: var(--ql-ink); border-color: var(--ql-ink); }
.ql-check .form-check-input:focus { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ql-focus); border-color: var(--ql-ink); }
.ql-check .form-check-label { font-weight: 700; font-size: .92rem; cursor: pointer; }

/* ---------- Nút đăng nhập ---------- */
.ql-card .qr-btn {
  display: block; width: 100%; padding: 11px 20px;
  font-family: var(--ql-font-head); font-weight: 800; font-size: 1.2rem; letter-spacing: .2px;
  color: var(--ql-ink); background: var(--ql-coral-d);
  border: 3px solid var(--ql-ink); border-radius: 999px; box-shadow: 5px 5px 0 var(--ql-ink);
  cursor: pointer; transition: transform .1s ease, box-shadow .1s ease, background-color .1s ease;
}
.ql-card .qr-btn:hover { color: var(--ql-ink); background: #ff9a84; transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ql-ink); }
.ql-card .qr-btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ql-ink); }
.ql-card .qr-btn:focus-visible { outline: 3px solid var(--ql-focus); outline-offset: 3px; }

/* ---------- Liên kết ---------- */
.ql-links.qr-divider { color: var(--ql-ink); font-weight: 700; font-size: .92rem; margin-top: 16px; }
.ql-links.qr-divider.mt-2 { margin-top: 6px; }
.ql-card .qr-link {
  display: inline-block; color: var(--ql-ink); font-weight: 800; text-decoration: none;
  padding: 1px 8px; border-radius: 999px; border: 2px solid transparent;
  transition: transform .1s ease, background-color .1s ease, border-color .1s ease;
}
.ql-card .qr-link:hover { color: var(--ql-ink); text-decoration: none; background: var(--ql-butter); border-color: var(--ql-ink); transform: translateY(-2px); }
.ql-card .qr-link:focus-visible { outline: 3px solid var(--ql-focus); outline-offset: 2px; }

/* ---------- Tài khoản mẫu (chỉ render khi Development) ---------- */
.ql-note.qr-note {
  background: var(--ql-butter); border: 3px dashed var(--ql-ink); border-radius: 16px;
  padding: 10px 14px; margin-top: 16px; font-size: .82rem; font-weight: 700; color: var(--ql-ink); line-height: 1.6;
}
.ql-note code { color: var(--ql-ink); background: rgba(255, 255, 255, .55); border-radius: 6px; padding: 1px 5px; font-size: .8rem; word-break: break-word; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .ql-flag { display: none; }
  .ql-road { bottom: 12%; height: 80px; }
  .ql-car { width: 70px; }
  .ql-prop.coin, .ql-spark.s3 { display: none; }
}
@media (max-width: 480px) {
  .ql-wrap { padding: 52px 12px 28px; }
  .ql-card.qr-card { padding: 40px 18px 20px; box-shadow: 6px 6px 0 var(--ql-ink); border-radius: 22px; }
  .ql-title.qr-title { font-size: 2rem; }
  .ql-deco.sun { width: 90px; height: 90px; }
  .ql-prop.star, .ql-prop.trophy { width: 40px; }
}
@media (max-height: 640px) and (orientation: landscape) { .ql-wrap { align-items: flex-start; } }

@media (prefers-reduced-motion: reduce) {
  .ql-deco, .ql-cloud, .ql-prop, .ql-spark, .ql-car, .ql-road::before, .ql-hero-car { animation: none !important; }
  .ql-hero-car { transform: translateX(-50%); }
  .ql-car.c1 { transform: translateX(8vw); } .ql-car.c2 { transform: translateX(34vw); }
  .ql-car.c3 { transform: translateX(62vw); } .ql-car.c4 { transform: translateX(84vw); }
  .ql-card .qr-btn, .ql-card .qr-input.form-control, .ql-card .qr-link { transition: none; }
}
