/* ============================================================
   AFK Phone — Auth pages (login / register)
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Sarabun:wght@400;500;600&display=swap");

:root {
  --bg: #0b0e1a;
  --bg-2: #0f1424;
  --surface: #161d33;
  --surface-2: #1b2340;
  --border: #263056;
  --text: #eef2ff;
  --muted: #9aa6c9;
  --muted-2: #6b779d;
  --primary: #2f6bff;
  --primary-2: #1d4ed8;
  --accent: #22d3ee;
  --accent-2: #34e3b0;
  --danger: #ff5d73;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -24px rgba(0,0,0,.7);
  --font: 'Kanit', 'Sarabun', system-ui, -apple-system, sans-serif;
}

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

/* ปุ่มสลับภาษา */
.lang-toggle {
  position: fixed; top: 18px; right: 18px; z-index: 20;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 16px; font-family: var(--font); font-weight: 500; font-size: .9rem;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.lang-toggle:hover { border-color: var(--primary); background: var(--surface-2); }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-weight: 300;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 18px;
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(680px 420px at 18% 8%, rgba(47,107,255,.28), transparent 60%),
    radial-gradient(620px 400px at 84% 22%, rgba(34,211,238,.18), transparent 60%),
    radial-gradient(560px 520px at 60% 100%, rgba(52,227,176,.10), transparent 60%);
}

a { color: inherit; text-decoration: none; }

/* ===== Card ===== */
.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 38px 36px 32px;
}

.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-size: 1.4rem; font-weight: 700; margin-bottom: 22px;
}
.auth-brand .accent { color: var(--accent); }
.auth-brand .logo { font-size: 1.5rem; }

.auth-head { margin-bottom: 24px; }
.auth-head h1 { font-size: 1.7rem; font-weight: 600; }
.auth-head p { color: var(--muted); font-size: .96rem; margin-top: .3rem; }

/* ===== Fields ===== */
.field { margin-bottom: 16px; }
.field-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .95rem; font-weight: 500; margin-bottom: .5rem;
}
.field-label .li { color: var(--primary); display: grid; place-items: center; }
.field-label .li svg { width: 18px; height: 18px; display: block; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .in-ico {
  position: absolute; left: 14px; color: var(--muted-2);
  display: grid; place-items: center; pointer-events: none;
}
.input-wrap .in-ico svg { width: 18px; height: 18px; display: block; }
.input-wrap input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px 14px 44px;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap input::placeholder { color: var(--muted-2); }
.input-wrap input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47,107,255,.22);
}
.input-wrap.has-toggle input { padding-right: 46px; }
.toggle-pass {
  position: absolute; right: 10px;
  background: none; border: 0; cursor: pointer;
  color: var(--muted); padding: 8px; display: grid; place-items: center;
  border-radius: 8px; transition: color .2s, background .2s;
}
.toggle-pass:hover { color: var(--text); background: rgba(255,255,255,.05); }
.toggle-pass svg { width: 20px; height: 20px; display: block; }

.field-error {
  color: var(--danger); font-size: .82rem; margin-top: .4rem;
  display: none;
}
.field.invalid input { border-color: var(--danger); }
.field.invalid .field-error { display: block; }

/* ===== Verify (mock Turnstile) ===== */
.verify {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: #1c1c1f;
  border: 1px solid #33343a;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 4px 0 18px;
  cursor: pointer;
  user-select: none;
  transition: border-color .2s;
}
.verify:hover { border-color: #4a4b52; }
.verify.verified { cursor: default; border-color: rgba(52,227,176,.5); }
.verify-left { display: flex; align-items: center; gap: 10px; }
.v-box {
  width: 22px; height: 22px; border-radius: 5px;
  border: 2px solid #6b6c73; flex: 0 0 auto;
  display: grid; place-items: center; background: #232428;
  transition: all .2s;
}
.v-spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #4a4b52; border-top-color: var(--accent-2);
  animation: spin .7s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.v-check { display: none; color: #fff; }
.v-check svg { width: 14px; height: 14px; display: block; }
.verify.loading .v-box { border-color: transparent; background: transparent; }
.verify.loading .v-spin { display: block; }
.verify.verified .v-box { background: var(--accent-2); border-color: var(--accent-2); }
.verify.verified .v-check { display: block; }
.v-text { font-size: .95rem; color: #d6d7de; }
.verify.verified .v-text { color: #fff; font-weight: 500; }
.v-brand { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.v-brand b { font-size: .74rem; color: #b7b8c0; font-weight: 600; }
.v-brand small { font-size: .64rem; color: #7d7e86; }

/* ===== Buttons ===== */
.btn-auth {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-family: var(--font); font-weight: 500; font-size: 1.05rem;
  border: 0; border-radius: var(--radius-sm);
  padding: 14px 20px; cursor: pointer;
  box-shadow: 0 12px 28px -10px rgba(47,107,255,.7);
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.btn-auth:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px rgba(47,107,255,.85); }
.btn-auth:active { transform: translateY(0); }
.btn-auth svg { width: 20px; height: 20px; }

.divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted-2); font-size: .88rem;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ===== Terms ===== */
.terms {
  display: flex; align-items: flex-start; gap: .6rem;
  margin: 2px 0 18px; font-size: .92rem; color: var(--muted);
  cursor: pointer;
}
.terms input { position: absolute; opacity: 0; width: 0; height: 0; }
.terms .box {
  width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto;
  border: 2px solid var(--border); background: var(--bg-2);
  display: grid; place-items: center; transition: all .2s; margin-top: 1px;
}
.terms .box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity .15s; }
.terms input:checked + .box { background: var(--primary); border-color: var(--primary); }
.terms input:checked + .box svg { opacity: 1; }
.terms input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(47,107,255,.3); }
.terms a { color: var(--accent); }
.terms.invalid .box { border-color: var(--danger); }

/* ===== Footer link ===== */
.auth-foot {
  text-align: center; margin-top: 20px;
  color: var(--muted); font-size: .95rem;
}
.auth-foot a { color: var(--accent); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

.auth-note {
  margin-top: 16px; text-align: center;
  color: var(--muted-2); font-size: .76rem; line-height: 1.5;
}

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--primary);
  color: var(--text); padding: .9rem 1.4rem; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 9999;
  font-size: .95rem; opacity: 0; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); }

@media (max-width: 480px) {
  .auth-card { padding: 30px 22px 26px; }
  .auth-head h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition: none !important; }
}
