/* user.css - Trang đăng nhập / đăng ký / tài khoản (html/user/*.html) + icon 充值 trên header */

:root {
  --hg-u-bg: #0b0b0d;
  --hg-u-card: #141417;
  --hg-u-field: #1f1f24;
  --hg-u-border: rgba(255, 255, 255, 0.08);
  --hg-u-text: #f2f2f4;
  --hg-u-muted: #8b8b95;
  --hg-u-pink: #ec237f;
  --hg-u-error: #ff5a6e;
}

/* ---------- Icon 充值 trên header ---------- */
.hg-pay-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  min-width: 36px;
  padding: 0 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.hg-pay-icon svg, .hg-profile-link svg { width: 22px; height: 22px; flex: none; }
.hg-pay-icon__text { display: none; }
@media (min-width: 768px) {
  .hg-pay-icon { padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 999px; }
  .hg-pay-icon__text { display: inline; }
}
.hg-pay-icon:hover { color: var(--hg-u-pink); }

.hg-profile-link {
  display: inline-flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 36px;
  height: 44px;
  color: var(--hg-u-muted);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  text-decoration: none;
}
.hg-profile-link:hover, .hg-profile-link:focus-visible { color: #fff; }

/* ---------- Thanh trên cùng + nút quay về trang chủ (trang đăng nhập / đăng ký) ---------- */
.hg-user-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 8px;
  background: rgba(11, 11, 13, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.hg-user-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  color: var(--hg-u-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.hg-user-back svg { width: 24px; height: 24px; }
.hg-user-back:hover { color: var(--hg-u-pink); }
.hg-user-topbar ~ .hg-user-page { padding-top: 24px; }
@media (min-width: 768px) {
  .hg-user-topbar { height: 60px; padding: 0 24px; }
  .hg-user-topbar ~ .hg-user-page { padding-top: 64px; }
}

/* ---------- Khung trang ---------- */
.hg-user-page {
  min-height: 70vh;
  padding: 24px 16px 56px;
  background: var(--hg-u-bg);
  color: var(--hg-u-text);
}
@media (min-width: 768px) { .hg-user-page { padding: 120px 16px 80px; } }

.hg-user-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 28px 20px 24px;
  border: 1px solid var(--hg-u-border);
  border-radius: 16px;
  background: var(--hg-u-card);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
@media (min-width: 768px) { .hg-user-card { padding: 36px 32px 28px; } }

.hg-user-title { margin: 0; font-size: 22px; font-weight: 800; line-height: 30px; }
.hg-user-sub { margin: 6px 0 0; color: var(--hg-u-muted); font-size: 13px; line-height: 20px; }

.hg-user-notice {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(236, 35, 127, 0.1);
  color: #ff7ab0;
  font-size: 13px;
  line-height: 20px;
}

/* ---------- Form ---------- */
.hg-user-form { margin-top: 22px; }
.hg-field { display: block; margin-bottom: 14px; }
.hg-field > span { display: block; margin-bottom: 6px; color: var(--hg-u-muted); font-size: 13px; }
.hg-field input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--hg-u-field);
  color: var(--hg-u-text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease;
}
.hg-field input:focus { border-color: rgba(236, 35, 127, 0.6); }
.hg-field input::placeholder { color: rgba(255, 255, 255, 0.3); }
.hg-field__row { display: flex; gap: 10px; }
.hg-field__row input { flex: 1; min-width: 0; }
.hg-captcha { flex: none; width: 112px; height: 46px; border-radius: 10px; background: #fff; cursor: pointer; object-fit: cover; }
.hg-field__hint { margin-top: 6px; color: var(--hg-u-muted); font-size: 12px; }

.hg-user-error { min-height: 20px; margin: 4px 0 10px; color: var(--hg-u-error); font-size: 13px; line-height: 20px; }

.hg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  background-image: var(--brand-cta, linear-gradient(90deg, #ff4a7b, #ec237f));
}
.hg-btn:disabled { opacity: .55; cursor: default; }
.hg-btn--ghost { background: var(--hg-u-field); background-image: none; color: var(--hg-u-text); }
.hg-btn + .hg-btn { margin-top: 10px; }
.hg-btn svg { width: 18px; height: 18px; }

.hg-user-switch { margin: 18px 0 0; color: var(--hg-u-muted); font-size: 13px; text-align: center; }
.hg-user-switch a { color: var(--hg-u-pink); font-weight: 600; text-decoration: none; }

/* ---------- Trang tài khoản ---------- */
.hg-profile { display: flex; align-items: center; gap: 14px; }
.hg-profile__avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--hg-u-field); }
.hg-profile__name { margin: 0; font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.hg-profile__group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--hg-u-muted);
  font-size: 12px;
}
.hg-profile__group.is-vip { background: linear-gradient(90deg, #ffd21f, #f5a623); color: #3a2400; font-weight: 700; }

.hg-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.hg-stat { padding: 14px; border-radius: 12px; background: var(--hg-u-field); }
.hg-stat__label { color: var(--hg-u-muted); font-size: 12px; }
.hg-stat__value { margin-top: 4px; font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }

/* ---------- Trang 充值 (user/buy) + 确认订单 (user/pay) ---------- */
.hg-user-page [hidden] { display: none !important; }
.hg-user-topbar { justify-content: space-between; }
.hg-user-topbar__home { padding: 0 10px; color: var(--hg-u-muted); font-size: 13px; text-decoration: none; }
.hg-user-topbar__home:hover { color: var(--hg-u-pink); }
.hg-strong { color: var(--hg-u-text); }

.hg-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hg-amount {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; padding: 8px 4px; border: 1px solid transparent; border-radius: 12px;
  background: var(--hg-u-field); color: var(--hg-u-text); font: inherit; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.hg-amount b { font-size: 20px; font-weight: 800; line-height: 1.1; }
.hg-amount small { margin-left: 2px; font-size: 12px; font-weight: 600; }
.hg-amount em { color: var(--hg-u-muted); font-size: 11px; font-style: normal; }
.hg-amount:hover { border-color: rgba(236, 35, 127, 0.4); }
.hg-amount.is-active { border-color: var(--hg-u-pink); background: rgba(236, 35, 127, 0.12); }
.hg-amount.is-active em { color: #ff7ab0; }
.hg-buy-points { margin: -4px 0 6px; color: var(--hg-u-muted); font-size: 13px; }
.hg-buy-points b { color: var(--hg-u-pink); font-size: 16px; }

.hg-card-redeem { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--hg-u-border); }
.hg-card-redeem summary { color: var(--hg-u-muted); font-size: 13px; cursor: pointer; }
.hg-card-redeem .hg-user-form { margin-top: 14px; }

.hg-order { margin: 18px 0 0; padding: 4px 14px; border-radius: 12px; background: var(--hg-u-field); }
.hg-order > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; }
.hg-order > div + div { border-top: 1px solid var(--hg-u-border); }
.hg-order dt { color: var(--hg-u-muted); }
.hg-order dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.hg-order__price { color: var(--hg-u-pink); font-size: 18px; font-weight: 800; }
.hg-user-notice--ok { background: rgba(46, 204, 113, 0.12); color: #5fe39a; }
.hg-user-notice--ok + .hg-btn { margin-top: 16px; }

.hg-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hg-methods > p { grid-column: 1 / -1; margin: 0; }
.hg-method { position: relative; cursor: pointer; }
.hg-method input { position: absolute; opacity: 0; pointer-events: none; }
.hg-method span {
  display: flex; align-items: center; justify-content: center; height: 46px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 10px; background: var(--hg-u-field);
  font-size: 14px; font-weight: 600; text-align: center;
}
.hg-method input:checked + span { border-color: var(--hg-u-pink); background: rgba(236, 35, 127, 0.12); }
.hg-method input:focus-visible + span { outline: 2px solid var(--hg-u-pink); outline-offset: 2px; }

.hg-pay-wait { margin-top: 22px; text-align: center; }
.hg-pay-wait__title { margin: 14px 0 6px; font-size: 16px; font-weight: 700; }
.hg-pay-wait .hg-btn { margin-top: 18px; }
.hg-pay-qr { display: inline-block; margin-bottom: 8px; padding: 10px; border-radius: 12px; background: #fff; }
.hg-pay-qr canvas, .hg-pay-qr table { display: block; }
.hg-spinner {
  width: 36px; height: 36px; margin: 6px auto 0; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--hg-u-pink);
  animation: hg-spin .8s linear infinite;
}
@keyframes hg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hg-spinner { animation-duration: 2.4s; } }
