/* login_question — auth UI (bright glass + animated aura) */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=Noto+Sans+Thai:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #1a1f2c;
  --muted: #5a6475;
  --line: rgba(255, 255, 255, 0.55);
  --surface: rgba(255, 255, 255, 0.42);
  --accent: #0707BF;
  --accent-2: #5555FF;
  --gold: #0707BF;
  --gold-light: #5555FF;
  --gold-mid: #1E1EE0;
  --gold-deep: #0505A0;
  --gold-dark: #040480;
  --danger: #030370;
  --ok: #0a7a45;
  --shadow: 0 30px 60px rgba(30, 40, 80, 0.14);
  --radius: 28px;
  --font: "Be Vietnam Pro", "Noto Sans Thai", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #f4f7ff;
  min-height: 100%;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ========== Login canvas ========== */
.auth-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  position: relative;
  overflow: hidden;
  background-color: #0f1419;
}

/* Full-bleed background video */
.auth-bg-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-bg-video__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

/* วอชทับวิดีโอ — ให้ฟอร์มอ่านง่ายโดยไม่กลบภาพ */
.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(160deg, rgba(10, 14, 24, 0.38) 0%, rgba(20, 28, 48, 0.28) 45%, rgba(12, 18, 30, 0.42) 100%);
}

.auth-page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(255, 255, 255, 0.12), transparent 55%);
}

/* Animated color aura (modern soft orbs) */
.auth-aura {
  position: absolute;
  inset: -8%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.auth-aura__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  will-change: transform;
  mix-blend-mode: multiply;
}
.auth-aura__blob--a {
  width: min(52vw, 460px);
  height: min(52vw, 460px);
  left: -10%;
  top: -8%;
  background: radial-gradient(circle, rgba(85, 85, 255, 0.55) 0%, rgba(7, 7, 191, 0.28) 45%, transparent 70%);
  animation: orb-a 16s ease-in-out infinite alternate;
}
.auth-aura__blob--b {
  width: min(56vw, 500px);
  height: min(56vw, 500px);
  right: -12%;
  top: 18%;
  background: radial-gradient(circle, rgba(80, 150, 255, 0.5) 0%, rgba(120, 210, 255, 0.28) 48%, transparent 72%);
  animation: orb-b 19s ease-in-out infinite alternate;
}
.auth-aura__blob--c {
  width: min(44vw, 380px);
  height: min(44vw, 380px);
  left: 30%;
  bottom: -14%;
  background: radial-gradient(circle, rgba(90, 220, 180, 0.45) 0%, rgba(255, 210, 120, 0.22) 50%, transparent 72%);
  animation: orb-c 14s ease-in-out infinite alternate;
}
.auth-aura__spark {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 25%, rgba(255,255,255,0.4) 0 1.5px, transparent 3px),
    radial-gradient(circle at 40% 70%, rgba(255,255,255,0.45) 0 2px, transparent 3px),
    radial-gradient(circle at 85% 65%, rgba(255,255,255,0.35) 0 1.5px, transparent 3px);
  animation: spark-drift 12s linear infinite;
  opacity: 0.65;
}

@keyframes orb-a {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(12%, 10%) scale(1.15); }
}
@keyframes orb-b {
  0%   { transform: translate(0, 0) scale(1.05); }
  100% { transform: translate(-10%, -8%) scale(1.18); }
}
@keyframes orb-c {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-8%, -14%) scale(1.2); }
}
@keyframes spark-drift {
  from { transform: translateY(0); }
  to   { transform: translateY(-28px); }
}


/* ========== Oscar glow particles (login) — canvas only ========== */
.auth-fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.auth-fx__particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .auth-aura__blob,
  .auth-aura__spark { animation: none !important; }
  .auth-fx__particles { display: none; }
  .auth-bg-video__media { display: none; }
  .auth-page { background-image: url("bg/login-bg.jpg"); background-size: cover; background-position: center; }
  .auth-btn-aura::before { animation: none !important; }
  .auth-btn-aura .btn-primary { animation: none !important; }
}

.auth-shell {
  width: min(420px, 100%);
  position: relative;
  z-index: 2;
}

/* Brand */
.auth-brand {
  text-align: center;
  margin-bottom: 20px;
  color: var(--ink);
}
.auth-brand__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  margin: 0 auto 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  max-width: none;
}
.auth-brand__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(220px, 64vw);
  max-height: 128px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12));
}
.auth-brand__mark {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 16px;
  display: none;
  place-items: center;
  background: linear-gradient(145deg, #0707BF, #5555FF);
  box-shadow: 0 12px 30px rgba(7, 7, 191, 0.35);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}
.auth-brand__logo-wrap.is-fallback .auth-brand__fallback,
.auth-brand__logo-wrap.is-fallback .auth-brand__mark {
  display: grid;
}
.auth-brand__logo-wrap.is-fallback .auth-brand__logo {
  display: none !important;
}
.auth-brand h1 { display: none; }
.auth-brand p,
.auth-brand__tag {
  margin: 0 auto;
  max-width: 280px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* ========== Glass card ========== */
.auth-card {
  position: relative;
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow:
    0 8px 32px rgba(40, 55, 100, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  padding: 30px 26px 32px;
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(255,255,255,0.55), transparent 65%);
  pointer-events: none;
}
.auth-card > * { position: relative; z-index: 1; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.auth-card__head {
  text-align: center;
  margin-bottom: 22px;
}
.auth-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #1a2030;
}
.auth-card .lead {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 7px;
  color: #3a4458;
  letter-spacing: 0.01em;
}
.field-box {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field-box:focus-within {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(7, 7, 191, 0.55);
  box-shadow: 0 0 0 4px rgba(7, 7, 191, 0.18);
}
.field-box:focus-within .field-box__ico {
  color: var(--gold-mid);
}
.field-box__ico {
  color: #8a93a5;
  font-size: 14px;
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
}
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 14px 0;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}
.field input::placeholder { color: #9aa3b2; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: none; }

/* ปุ่มเข้าสู่ระบบ — ทอง + aura วิ่งรอบปุ่ม */
.auth-btn-aura {
  position: relative;
  margin-top: 10px;
  padding: 2px;
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
}
.auth-btn-aura::before {
  content: "";
  position: absolute;
  inset: -120%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 40deg,
    rgba(85, 85, 255, 0.3) 70deg,
    #5555FF 110deg,
    #ECECFF 145deg,
    #0707BF 185deg,
    #3A3AF0 225deg,
    rgba(255, 255, 255, 0.85) 260deg,
    rgba(85, 85, 255, 0.4) 300deg,
    transparent 340deg 360deg
  );
  animation: auth-btn-aura-spin 2.6s linear infinite;
  z-index: 0;
}
.auth-btn-aura .btn-primary {
  position: relative;
  z-index: 1;
  margin-top: 0;
  width: 100%;
  animation: auth-btn-glow-pulse 2.6s ease-in-out infinite alternate;
}
.auth-btn-aura:hover .btn-primary {
  animation-duration: 1.8s;
}

@keyframes auth-btn-aura-spin {
  to { transform: rotate(360deg); }
}
@keyframes auth-btn-glow-pulse {
  from {
    box-shadow:
      0 14px 28px rgba(7, 7, 191, 0.4),
      0 0 0 rgba(85, 85, 255, 0);
  }
  to {
    box-shadow:
      0 16px 34px rgba(7, 7, 191, 0.52),
      0 0 22px rgba(85, 85, 255, 0.5),
      0 0 38px rgba(7, 7, 191, 0.28);
  }
}

.btn-primary {
  background: linear-gradient(135deg, #0505A0 0%, #0707BF 42%, #5555FF 100%);
  color: #F0F0FF;
  box-shadow: 0 14px 28px rgba(7, 7, 191, 0.4);
  margin-top: 10px;
  letter-spacing: 0.02em;
}
.btn-primary:hover {
  box-shadow: 0 16px 32px rgba(7, 7, 191, 0.52);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.75);
  margin-top: 10px;
  backdrop-filter: blur(8px);
}
.btn-danger {
  background: #ECECFF;
  color: var(--gold-deep);
}

.alert {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}
.alert-err {
  background: rgba(253, 246, 230, 0.9);
  color: #040480;
  border: 1px solid rgba(7, 7, 191, 0.4);
}
.alert-ok {
  background: rgba(232, 247, 239, 0.85);
  color: #0a6840;
  border: 1px solid rgba(182, 228, 200, 0.8);
}
.alert-info {
  background: rgba(238, 245, 255, 0.85);
  color: #114a9b;
  border: 1px solid rgba(201, 220, 255, 0.8);
}

.foot-note {
  text-align: center;
  margin-top: 18px;
  color: rgba(30, 40, 60, 0.55);
  font-size: 12.5px;
  font-weight: 500;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ========== App shell (main / tools) ========== */
.app-page {
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(7,7,191,.08), transparent 50%),
    radial-gradient(800px 400px at 100% 0%, rgba(20,100,210,.08), transparent 45%),
    #f6f7fb;
  padding: 24px 16px 48px;
}
.app-top {
  max-width: 920px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-top__brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.app-top__spacer { flex: 1; }
.app-top a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.app-top a:hover { color: var(--accent); }

.app-card {
  max-width: 920px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid rgba(15,28,46,.08);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(15,28,46,.06);
  padding: 28px 26px;
}
.app-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.app-card__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.app-card__title-row h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.btn-back-circle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(15, 28, 46, 0.12);
  background: #fff;
  color: #1a1f2c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 28, 46, 0.08);
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  padding: 0;
  font-size: 15px;
}
.btn-back-circle:hover {
  background: #f4f6f9;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 28, 46, 0.12);
}
.btn-back-circle:active {
  transform: none;
}
.app-card .lead { color: var(--muted); margin: 0 0 20px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.meta {
  background: #f7f9fc;
  border: 1px solid rgba(15,28,46,.08);
  border-radius: 14px;
  padding: 14px 16px;
}
.meta small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.meta b { font-size: 16px; }

.pass-result {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a1f2c, #02025A);
  color: #fff;
}
.pass-result small { opacity: .75; display: block; margin-bottom: 6px; }
.pass-result code {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-family: ui-monospace, Consolas, monospace;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.toolbar .btn { width: auto; min-width: 160px; }

@media (max-width: 520px) {
  .auth-card { padding: 24px 18px 26px; border-radius: 22px; }
  .auth-brand__logo-wrap { max-width: 100%; }
}
