/*
Theme Name: KGame LLwin Auth
Theme URI: https://kgame.studio
Author: Fong
Description: WordPress theme giao diện login/register giống LLwin (xanh #1678FF, clean). Form gửi về Google Sheet qua Apps Script. Cấu hình tại Giao diện → KLwin Auth.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: kgame-llwin
*/

/* ========== RESET / BASE ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  background: var(--klw-bg, #EFF7FF);
}
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; }
ul { list-style: none; }
input, button, select { font-family: inherit; }
svg { width: 1em; height: 1em; }
.klw-prefix svg, .klw-tab svg, .klw-eye svg { width: 20px; height: 20px; }

/* ========== THEME TOKENS (LLwin clean blue) ========== */
:root {
  --klw-accent: #1678FF;
  --klw-accent-dark: #0A67E7;
  --klw-bg: #EFF7FF;
  --klw-card-bg: #FFFFFF;
  --klw-text: #333333;
  --klw-text-sub: #999999;
  --klw-border: #E3E3E3;
  --klw-input-bg: #F0F4F7;
  --klw-radius: 12px;
  --klw-radius-sm: 8px;
  --klw-max: 460px;
}

/* ========== PAGE WRAPPER ========== */
.klw-page {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(22,120,255,0.12) 0%, rgba(239,247,255,1) 42%),
    var(--klw-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
}
.klw-page.has-bg {
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

/* ========== HERO / SLOGAN ========== */
.klw-hero {
  width: 100%;
  max-width: var(--klw-max);
  padding-top: calc(28px + env(safe-area-inset-top));
  display: flex;
  justify-content: center;
}
.klw-hero img {
  max-height: 120px;
  width: auto;
  object-fit: contain;
}

/* ========== AUTH CARD ========== */
.klw-card {
  width: 100%;
  max-width: var(--klw-max);
  margin-top: 18px;
}

/* ========== TABS ========== */
.klw-tabs {
  display: flex;
  position: relative;
  border-bottom: 1px solid var(--klw-border);
  margin-bottom: 22px;
}
.klw-tab {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--klw-text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  position: relative;
  transition: color .2s;
}
.klw-tab svg { width: 20px; height: 20px; fill: currentColor; }
.klw-tab.is-active { color: var(--klw-accent); font-weight: 600; }
.klw-tab.is-active::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 50%;
  transform: translateX(-50%);
  width: 46px; height: 3px;
  border-radius: 3px;
  background: var(--klw-accent);
}

/* ========== FORM ========== */
.klw-form { display: none; }
.klw-form.is-active { display: block; animation: klwFade .25s ease; }
@keyframes klwFade { from { opacity: 0; transform: translateY(6px);} to { opacity:1; transform:none;} }

.klw-subtitle {
  font-size: 13px;
  color: var(--klw-text-sub);
  margin-bottom: 16px;
  text-align: left;
}

.klw-error {
  background: #FFECEC;
  color: #E02424;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--klw-radius-sm);
  margin-bottom: 14px;
  line-height: 1.4;
}
.klw-error.is-hidden { display: none; }

/* ----- input group ----- */
.klw-group { margin-bottom: 14px; }
.klw-group > label {
  display: block;
  font-size: 13px;
  color: var(--klw-text);
  margin-bottom: 6px;
  font-weight: 500;
}
.klw-req { color: #E02424; }

.klw-field {
  display: flex;
  align-items: center;
  background: var(--klw-input-bg);
  border: 1px solid transparent;
  border-radius: var(--klw-radius-sm);
  padding: 0 12px;
  transition: border-color .2s, background .2s;
}
.klw-field:focus-within {
  border-color: var(--klw-accent);
  background: #fff;
}
.klw-field .klw-prefix {
  display: flex; align-items: center;
  color: var(--klw-accent);
  margin-right: 8px;
}
.klw-field .klw-prefix svg { width: 20px; height: 20px; fill: currentColor; }
.klw-field input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  height: 48px;
  font-size: 15px;
  color: var(--klw-text);
  min-width: 0;
}
.klw-field input::placeholder { color: #B5BCC4; }

/* eye toggle */
.klw-eye {
  background: none; border: none; cursor: pointer;
  color: var(--klw-text-sub);
  display: flex; align-items: center;
  padding: 6px;
}
.klw-eye svg { width: 22px; height: 22px; fill: currentColor; }

/* phone country */
.klw-country {
  display: flex; align-items: center;
  gap: 4px;
  padding-right: 10px;
  margin-right: 8px;
  border-right: 1px solid var(--klw-border);
  font-size: 14px;
  color: var(--klw-text);
  white-space: nowrap;
}
.klw-country img { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; }
.klw-country select {
  border: none; background: transparent; outline: none;
  font-size: 14px; color: var(--klw-text); cursor: pointer;
}

/* ----- password strength ----- */
.klw-strength { margin: -4px 0 14px; }
.klw-strength .klw-strength-head {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--klw-text-sub);
  margin-bottom: 5px;
}
.klw-strength-bars { display: flex; gap: 5px; }
.klw-strength-bars span {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--klw-border);
  transition: background .25s;
}
.klw-strength-bars.lv1 span:nth-child(1) { background:#E02424; }
.klw-strength-bars.lv2 span:nth-child(-n+2) { background:#F59E0B; }
.klw-strength-bars.lv3 span:nth-child(-n+3) { background:#3B82F6; }
.klw-strength-bars.lv4 span { background:#16A34A; }

/* ----- checkbox ----- */
.klw-check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--klw-text-sub);
  margin: 4px 0 18px;
  line-height: 1.5;
  cursor: pointer;
}
.klw-check input { margin-top: 2px; accent-color: var(--klw-accent); width:16px; height:16px; flex-shrink:0; }
.klw-check a { color: var(--klw-accent); }

/* ----- submit button ----- */
.klw-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: linear-gradient(90deg, var(--klw-accent), var(--klw-accent-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 6px 16px rgba(22,120,255,0.32);
}
.klw-btn:hover { opacity: .94; }
.klw-btn:active { transform: translateY(1px); }
.klw-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ----- quick links ----- */
.klw-quicklinks {
  display: flex; justify-content: center; gap: 28px;
  margin-top: 18px;
}
.klw-quicklinks a {
  font-size: 14px; color: var(--klw-text);
  position: relative;
}
.klw-quicklinks a:not(:last-child)::after {
  content: ""; position: absolute; right: -14px; top: 3px;
  width: 1px; height: 13px; background: var(--klw-border);
}

/* ----- third-party / direct contact ----- */
.klw-third {
  margin-top: 26px;
  text-align: center;
}
.klw-third .klw-third-title {
  position: relative;
  font-size: 13px; color: var(--klw-text-sub);
  margin-bottom: 16px;
}
.klw-third .klw-third-title::before,
.klw-third .klw-third-title::after {
  content:""; position:absolute; top:50%;
  width: 28%; height:1px; background: var(--klw-border);
}
.klw-third .klw-third-title::before { left: 0; }
.klw-third .klw-third-title::after  { right: 0; }
.klw-third-icons { display: flex; justify-content: center; gap: 20px; }
.klw-third-icons a {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--klw-border);
  transition: transform .15s;
}
.klw-third-icons a:hover { transform: translateY(-2px); }
.klw-third-icons a img, .klw-third-icons a svg { width: 26px; height: 26px; }

/* ----- success done ----- */
.klw-done {
  text-align: center; padding: 30px 10px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.klw-done b { font-size: 18px; color: var(--klw-accent); }
.klw-done span { font-size: 14px; color: var(--klw-text-sub); }

/* ========== FLOATING CONTACT BAR ========== */
.klw-float {
  position: fixed;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 12px;
}
.klw-float.pos-right { right: 18px; bottom: 90px; }
.klw-float.pos-left  { left: 18px;  bottom: 90px; }
.klw-float a {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: transform .15s;
}
.klw-float a:hover { transform: scale(1.06); }
.klw-float a img { width: 54px; height: 54px; border-radius:50%; object-fit: cover; }
.klw-float.pulse a::after {
  content:""; position:absolute; inset:0; border-radius:50%;
  box-shadow: 0 0 0 0 rgba(22,120,255,.5);
  animation: klwPulse 1.8s infinite;
}
@keyframes klwPulse {
  0% { box-shadow: 0 0 0 0 rgba(22,120,255,.5); }
  70% { box-shadow: 0 0 0 14px rgba(22,120,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,120,255,0); }
}

/* ========== DESKTOP ========== */
@media (min-width: 768px) {
  .klw-card {
    background: var(--klw-card-bg);
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(22,120,255,0.12);
    padding: 28px 30px 34px;
    margin-top: 24px;
  }
  .klw-hero img { max-height: 150px; }
}
