/* Atlas glass theme for index_new.php and sale_face_login_new.php.
   Every new class is prefixed atl- so Bootstrap and main.css can't collide with it.
   The un-prefixed rules under .atl-face restyle the face-scan page's existing
   elements, whose ids/classes its JavaScript depends on. */

:root {
  --atl-ink: #0f1c33;
  --atl-ink-2: #3f4f6b;
  --atl-ink-3: #6a7a96;
  --atl-sky-1: #e3ebf5;
  --atl-sky-2: #a9bcd6;
  --atl-sky-3: #6c86aa;
  --atl-glass-hi: rgba(255, 255, 255, .38);
  --atl-glass-lo: rgba(255, 255, 255, .12);
  --atl-glass-edge: rgba(255, 255, 255, .6);
  --atl-field: rgba(255, 255, 255, .42);
  --atl-field-focus: rgba(255, 255, 255, .66);
  --atl-accent: #5aa2f5;
  --atl-btn: #0f1c33;
  --atl-btn-hover: #1d3050;
  --atl-ok-bg: rgba(223, 245, 233, .78);
  --atl-ok: #1e6b47;
  --atl-err-bg: rgba(253, 229, 229, .8);
  --atl-err: #8e2a22;
  --atl-info-bg: rgba(228, 239, 252, .78);
  --atl-info: #1a4f8a;
  --atl-wait-bg: rgba(252, 244, 219, .8);
  --atl-wait: #6f5a06;
  --atl-sans: "Outfit", "Kanit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --atl-thai: "Kanit", "Outfit", system-ui, sans-serif;
  --atl-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

html, body.atl-body { min-height: 100%; }
body.atl-body {
  margin: 0;
  padding: 0;
  display: block;
  background: var(--atl-sky-2);
  font-family: var(--atl-thai);
  font-weight: 300;
  color: var(--atl-ink);
  overflow-x: hidden;
}
body.atl-body *, body.atl-body *::before, body.atl-body *::after { box-sizing: border-box; }

/* ---------- atmosphere ---------- */
.atl-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1100px 700px at 72% -12%, #f7fafd 0%, rgba(247, 250, 253, 0) 62%),
    radial-gradient(800px 600px at 8% 28%, #eef3f9 0%, rgba(238, 243, 249, 0) 60%),
    linear-gradient(180deg, var(--atl-sky-1) 0%, var(--atl-sky-2) 48%, var(--atl-sky-3) 100%);
}
.atl-lens {
  position: absolute; top: -260px; right: -180px; width: 680px; height: 680px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .75);
  background: radial-gradient(circle at 32% 34%, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 58%);
  box-shadow: inset 0 0 90px rgba(255, 255, 255, .55), 0 0 70px rgba(255, 255, 255, .3);
}
.atl-beam {
  position: absolute; top: -10%; right: 28%; width: 200px; height: 120%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .35), rgba(255, 255, 255, 0));
  filter: blur(22px); transform: skewX(-8deg);
}

/* ---------- layout ---------- */
.atl-stage {
  position: relative; z-index: 1;
  max-width: 1140px; margin: 0 auto;
  padding: 22px 20px 28px;
  display: grid; gap: 18px 28px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  grid-template-areas: "top top" "hero panel" "foot foot";
}
.atl-top { grid-area: top; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.atl-brand { display: flex; align-items: center; gap: 12px; }
.atl-logo {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  /* The logo file has lots of white space; zoom in so only the round K emblem shows */
  background: #ffffff url("../assets/logo%20kitsiri-01.png") 50% 28% / 234% auto no-repeat;
  box-shadow: 0 4px 14px -6px rgba(15, 28, 51, .45), inset 0 0 0 1px rgba(255, 255, 255, .8);
}
.atl-brand-name { font-family: var(--atl-sans); font-weight: 400; font-size: 13px; letter-spacing: .5em; color: var(--atl-ink-2); }
.atl-tag { font-family: var(--atl-mono); font-size: 12px; letter-spacing: .08em; color: var(--atl-ink-3); }

.atl-hero { grid-area: hero; position: relative; min-height: 600px; }
.atl-copy { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.atl-eyebrow { font-family: var(--atl-mono); font-size: 11px; letter-spacing: .35em; color: var(--atl-ink-3); text-transform: uppercase; }
.atl-h1 { margin: 0; font-family: var(--atl-sans); font-weight: 300; font-size: clamp(52px, 7.4vw, 92px); line-height: .95; letter-spacing: -.02em; color: var(--atl-ink); }
.atl-sub { margin: 0; font-family: var(--atl-sans); font-weight: 200; font-size: clamp(28px, 4vw, 46px); line-height: 1.1; color: var(--atl-ink-2); }
.atl-lede { margin: 6px 0 0; max-width: 20ch; font-size: 16px; font-weight: 300; line-height: 1.5; color: var(--atl-ink-2); }
.atl-steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; letter-spacing: .04em; color: var(--atl-ink-3); }
.atl-steps li { display: flex; align-items: center; gap: 10px; transition: color .3s; }
.atl-steps li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid currentColor; transition: background .3s, box-shadow .3s; }
.atl-steps li.done { color: var(--atl-ink); }
.atl-steps li.done::before { background: var(--atl-ink); }
.atl-steps li.now { color: var(--atl-ink); font-weight: 400; }
.atl-steps li.now::before { background: #cfe8ff; border-color: var(--atl-accent); box-shadow: 0 0 10px var(--atl-accent); }

.atl-robot {
  position: absolute; z-index: 1; right: -70px; bottom: -40px; width: min(540px, 92%); aspect-ratio: 600 / 620;
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 97%);
  mask-image: linear-gradient(180deg, #000 72%, transparent 97%);
}
.atl-robot-float { width: 100%; height: 100%; animation: atl-float 6s ease-in-out infinite; }
.atl-robot svg { width: 100%; height: 100%; display: block; overflow: visible; }
@keyframes atl-float { 50% { transform: translateY(-10px); } }

/* ---------- glass ---------- */
.atl-glass {
  background: linear-gradient(135deg, var(--atl-glass-hi), var(--atl-glass-lo));
  border: 1px solid var(--atl-glass-edge);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 30px 60px -30px rgba(20, 40, 80, .45), inset 0 1px 0 rgba(255, 255, 255, .65);
}
.atl-panel { grid-area: panel; align-self: center; border-radius: 26px; padding: 24px; display: flex; flex-direction: column; gap: 16px; position: relative; color: var(--atl-ink); }
.atl-panel-head { display: grid; grid-template-columns: 54px 1fr; gap: 14px; align-items: center; }
.atl-icon-tile { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; }
.atl-panel-title { margin: 0; font-family: var(--atl-thai); font-size: 20px; font-weight: 400; color: var(--atl-ink); }
.atl-muted { margin: 2px 0 0; font-size: 13px; color: var(--atl-ink-2); }

.atl-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 400; color: var(--atl-ink-2); }
.atl-input-wrap { position: relative; }
.atl-input {
  display: block; width: 100%; height: 50px; padding: 0 70px 0 16px;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, .7);
  background: var(--atl-field); color: var(--atl-ink);
  font-family: var(--atl-thai); font-size: 16px; font-weight: 300;
  transition: background .2s, box-shadow .2s, border-color .2s;
}
.atl-input::placeholder { color: rgba(15, 28, 51, .45); }
.atl-input:focus { outline: none; background: var(--atl-field-focus); border-color: #ffffff; box-shadow: 0 0 0 3px rgba(90, 162, 245, .35); }
.atl-peek { position: absolute; right: 7px; top: 7px; height: 36px; padding: 0 12px; border-radius: 10px; border: none; background: rgba(255, 255, 255, .5); color: var(--atl-ink-2); font-family: var(--atl-thai); font-size: 13px; cursor: pointer; }
.atl-peek:hover { background: rgba(255, 255, 255, .8); }

.atl-btn-main {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 12px 18px;
  border: none; border-radius: 16px; cursor: pointer;
  background: var(--atl-btn); color: #ffffff !important;
  font-family: var(--atl-thai); font-size: 17px; font-weight: 400; letter-spacing: .01em;
  text-decoration: none !important;
  box-shadow: 0 14px 26px -14px rgba(15, 28, 51, .75);
  transition: background .2s, transform .08s;
}
.atl-btn-main:hover { background: var(--atl-btn-hover); }
.atl-btn-main:active { transform: translateY(1px); }
.atl-text-btn {
  display: block; margin: 14px auto 0; padding: 6px 10px; border: none; background: none; cursor: pointer;
  font-family: var(--atl-thai); font-size: 14px; color: var(--atl-ink-2); text-decoration: underline; text-underline-offset: 3px;
}
.atl-text-btn:hover { color: var(--atl-ink); }
.atl-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }

.atl-foot { grid-area: foot; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: #ffffff; }
.atl-foot p { margin: 0; line-height: 1.7; }
.atl-slogan { font-family: var(--atl-mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; }

body.atl-body button:focus-visible, body.atl-body a:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }

/* ---------- face-scan page: restyle the existing elements ---------- */
.atl-face .cam-wrap {
  position: relative; width: 100%; border-radius: 20px; overflow: hidden;
  background: #0b1220; border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 18px 40px -22px rgba(10, 20, 40, .8);
}
.atl-face .cam-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30%; pointer-events: none;
  background: linear-gradient(180deg, rgba(160, 205, 255, 0), rgba(160, 205, 255, .22), rgba(160, 205, 255, 0));
  animation: atl-scan 2.6s ease-in-out infinite;
}
@keyframes atl-scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(340%); } }
/* The face-api overlay is drawn in mirrored coordinates, so video and canvas must flip together */
.atl-face #video { width: 100%; display: block; transform: scaleX(-1); }
.atl-face #overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: scaleX(-1); }
.atl-face .cam-status {
  position: absolute; z-index: 2; bottom: 12px; left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
  padding: 5px 14px; border-radius: 999px;
  background: rgba(10, 20, 40, .55); border: 1px solid rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #ffffff; font-size: 13px; white-space: nowrap;
}

.atl-face .status-box { display: none; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 400; text-align: center; border: 1px solid rgba(255, 255, 255, .6); }
.atl-face .status-box.info { display: block; background: var(--atl-info-bg); color: var(--atl-info); }
.atl-face .status-box.success { display: block; background: var(--atl-ok-bg); color: var(--atl-ok); }
.atl-face .status-box.error { display: block; background: var(--atl-err-bg); color: var(--atl-err); }
.atl-face .status-box.loading { display: block; background: var(--atl-wait-bg); color: var(--atl-wait); }

.atl-face .tabs { display: flex; gap: 8px; padding: 5px; border-radius: 16px; background: rgba(255, 255, 255, .28); border: 1px solid rgba(255, 255, 255, .55); }
.atl-face .tab-btn {
  flex: 1; padding: 10px; border: none; border-radius: 12px; background: transparent; cursor: pointer;
  font-family: var(--atl-thai); font-size: 14px; font-weight: 400; color: var(--atl-ink-2); transition: background .2s, color .2s;
}
.atl-face .tab-btn:hover:not(.active) { background: rgba(255, 255, 255, .4); }
.atl-face .tab-btn.active { background: var(--atl-btn); color: #ffffff; box-shadow: 0 8px 16px -10px rgba(15, 28, 51, .8); }

.atl-face .reg-form label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--atl-ink-2); }
.atl-face .reg-form input {
  display: block; width: 100%; height: 46px; padding: 0 14px; margin-bottom: 12px;
  border-radius: 13px; border: 1px solid rgba(255, 255, 255, .7);
  background: var(--atl-field); color: var(--atl-ink); font-family: var(--atl-thai); font-size: 15px;
}
.atl-face .reg-form input:focus { outline: none; background: var(--atl-field-focus); border-color: #ffffff; box-shadow: 0 0 0 3px rgba(90, 162, 245, .35); }
.atl-face .btn-verify {
  width: 100%; padding: 11px; margin-bottom: 10px; border-radius: 13px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .35);
  font-family: var(--atl-thai); font-size: 14px; color: var(--atl-ink); transition: background .2s;
}
.atl-face .btn-verify:hover { background: rgba(255, 255, 255, .6); }
.atl-face .verified-badge { display: none; margin-bottom: 10px; padding: 9px; border-radius: 12px; text-align: center; font-size: 13.5px; background: var(--atl-ok-bg); color: var(--atl-ok); }
.atl-face .btn-action { width: 100%; padding: 13px; border: 0; border-radius: 14px; cursor: pointer; font-family: var(--atl-thai); font-size: 15px; font-weight: 400; transition: background .2s; }
.atl-face .btn-register { background: var(--atl-btn); color: #ffffff; }
.atl-face .btn-register:hover { background: var(--atl-btn-hover); }
.atl-face .btn-action:disabled { opacity: .5; cursor: not-allowed; }
.atl-face .spinner { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: middle; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #ffffff; border-radius: 50%; animation: atl-spin .7s linear infinite; }
@keyframes atl-spin { to { transform: rotate(360deg); } }
.atl-face .hint { margin: 8px 0 0; font-size: 13px; color: var(--atl-ink-2); text-align: center; }
.atl-face .hint:empty { display: none; }
.atl-face .back-link { text-align: center; }
.atl-face .back-link a { font-size: 14px; color: var(--atl-ink-2); text-decoration: underline; text-underline-offset: 3px; }
.atl-face #login-panel { display: none; }

/* ---------- "face registered" dialog (light; the admin theme restyles it dark/gold) ---------- */
.atl-done {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 20px;
  background: rgba(15, 28, 51, .35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .2s ease;
}
.atl-done.show { opacity: 1; }
.atl-done-card {
  width: 100%; max-width: 400px; padding: 28px 24px 22px; border-radius: 26px; text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .6));
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 40px 80px -30px rgba(15, 28, 51, .6);
  transform: translateY(10px) scale(.97); transition: transform .25s ease;
}
.atl-done.show .atl-done-card { transform: none; }
.atl-done-check {
  width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  color: #ffffff; background: linear-gradient(135deg, #34d399, #15803d);
  box-shadow: 0 0 0 8px rgba(34, 197, 94, .15), 0 12px 26px -10px rgba(21, 128, 61, .6);
}
.atl-done-card h2 { margin: 0 0 8px; font-family: var(--atl-thai); font-size: 22px; font-weight: 500; color: var(--atl-ink); }
.atl-done-card p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.7; color: var(--atl-ink-2); }
.atl-done-card p b { color: var(--atl-ink); font-family: var(--atl-sans); font-size: 17px; }
.atl-done-actions { display: flex; flex-direction: column; gap: 10px; }
.atl-done .atl-btn-ghost {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px;
  border-radius: 16px; cursor: pointer; border: 1px solid rgba(15, 28, 51, .18); background: rgba(255, 255, 255, .6);
  color: var(--atl-ink); font-family: var(--atl-thai); font-size: 15px;
}
.atl-done .atl-btn-ghost:hover { background: rgba(255, 255, 255, .9); }

/* ---------- phones ---------- */
@media (max-width: 880px) {
  .atl-stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "hero" "panel" "foot"; padding-inline: 16px; }
  .atl-hero { min-height: 430px; }
  .atl-robot { right: -8%; bottom: -60px; width: 88%; }
  /* Face page: keep the camera near the top, so the hero is a compact strip */
  .atl-face .atl-hero { min-height: 250px; }
  .atl-face .atl-robot { width: 52%; right: -6%; bottom: -34px; }
  .atl-face .atl-steps { display: none; }
  /* Lighter glass on phones so face detection keeps its frame rate */
  .atl-glass { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .atl-lens { width: 460px; height: 460px; top: -200px; right: -200px; }
}
@media (prefers-reduced-motion: reduce) {
  .atl-robot-float, .atl-face .cam-wrap::after { animation: none; }
}
