/* KGame LLwin Popup — mọi selector đều có tiền tố klw-, không đặt rule toàn cục để không ảnh hưởng theme của site. */

.klw-modal,
.klw-modal *,
.klw-float,
.klw-float * {
  box-sizing: border-box;
}

/* Màu mặc định; plugin ghi đè bằng style inline theo cấu hình trong admin */
.klw-modal {
  --klw-accent: #1678FF;
  --klw-bg: #FFFFFF;
  --klw-btn: #1678FF;
  --klw-btn-text: #FFFFFF;
  --klw-text: #333333;
  --klw-text-sub: #999999;
  --klw-border: #E3E3E3;
  --klw-input-bg: #F0F4F7;
  --klw-input-text: #333333;
  --klw-input-border: #F0F4F7;
  --klw-radius-sm: 8px;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--klw-text);
  line-height: 1.4;
}
.klw-modal[hidden] { display: none !important; }

html.klw-lock { overflow: hidden; }

.klw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 60, 0.55);
  animation: klwFadeIn .2s ease;
}

.klw-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: #fff;
  background: var(--klw-bg);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 26px 24px 28px;
  animation: klwPop .22s ease;
}

.klw-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--klw-input-bg);
  color: #666;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* Slogan tràn sát mép trên và hai bên khung popup (bù lại phần đệm) */
.klw-hero {
  margin: -26px -24px 18px;
}
.klw-hero img {
  display: block;
  width: 100%;
  height: auto;
}

/* ----- tabs ----- */
.klw-tabs {
  display: flex;
  position: relative;
  border-bottom: 1px solid var(--klw-border);
  margin-bottom: 20px;
}
.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; }

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

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

.klw-group { margin-bottom: 14px; }
.klw-group > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.klw-req { color: #E02424; }

.klw-field {
  display: flex;
  align-items: center;
  background: var(--klw-input-bg);
  border: 1px solid var(--klw-input-border);
  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: var(--klw-bg);
}
.klw-prefix {
  display: flex;
  align-items: center;
  color: var(--klw-accent);
  margin-right: 8px;
}
.klw-prefix svg,
.klw-eye svg { width: 20px; height: 20px; fill: currentColor; }

.klw-field input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--klw-input-text);
}
.klw-field input::placeholder { color: #B5BCC4; }

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

.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;
  white-space: nowrap;
}
.klw-country .klw-flag { display: block; width: 20px; height: 14px; border-radius: 2px; }
.klw-cc { font-size: 14px; color: var(--klw-text); }
.klw-country select {
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 14px;
  color: var(--klw-text);
  cursor: pointer;
}

/* ----- password strength ----- */
.klw-strength { margin: -4px 0 14px; }
.klw-hint {
  display: block;
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--klw-text-sub);
}

.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;
  cursor: pointer;
}
.klw-check input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--klw-accent);
}
.klw-check a { color: var(--klw-accent); }

/* ----- submit ----- */
.klw-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: var(--klw-btn);
  color: var(--klw-btn-text);
  font: inherit;
  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-modal a,
.klw-float a {
  text-decoration: none;
}
.klw-quicklinks a {
  position: relative;
  font-size: 14px;
  color: var(--klw-text);
}
.klw-quicklinks a:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -14px;
  top: 3px;
  width: 1px;
  height: 13px;
  background: var(--klw-border);
}

/* ----- direct contact in popup ----- */
.klw-third {
  margin-top: 26px;
  text-align: center;
}
.klw-third-title {
  position: relative;
  font-size: 13px;
  color: var(--klw-text-sub);
  margin-bottom: 16px;
}
.klw-third-title::before,
.klw-third-title::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--klw-border);
}
.klw-third-title::before { left: 0; }
.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 img { width: 26px; height: 26px; }

.klw-letter {
  font-weight: 700;
  font-size: 20px;
  color: var(--klw-accent);
}

/* ----- success ----- */
.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;
  bottom: 90px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.klw-float.pos-right { right: 18px; }
.klw-float.pos-left  { left: 18px; }
.klw-float a {
  position: relative;
  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%;
  animation: klwPulse 1.8s infinite;
}

/* ----- mobile: popup gọn ở giữa, vẫn thấy trang chủ phía sau ----- */
@media (max-width: 480px) {
  .klw-modal { padding: 12px; }
  .klw-modal-dialog {
    width: min(340px, calc(100vw - 24px));
    max-width: none;
    height: auto;
    max-height: 78vh;
    max-height: 78dvh;
    padding: 18px 16px 20px;
    border-radius: 16px;
  }
  .klw-hero { margin: -18px -16px 14px; }
  .klw-tab { font-size: 15px; padding: 10px 0; }
  .klw-modal-close { top: 6px; right: 6px; width: 30px; height: 30px; font-size: 20px; }
  .klw-quicklinks { gap: 12px; flex-wrap: wrap; }
  .klw-quicklinks a { font-size: 13px; white-space: nowrap; }
  .klw-quicklinks a:not(:last-child)::after { right: -7px; }
}

@keyframes klwFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes klwFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes klwPop {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: none; }
}
@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); }
}
