/* ============================================================
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
ul { list-style: none; }

input, textarea, select { font-size: 16px; }

:root {
  --bg: #020617;
  --bg-2: #0a1628;
  --bg-3: #0d1b30;
  --elev: #111f38;
  --border: #1e3a5f;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --accent-3: #60a5fa;
  --glow: rgba(59, 130, 246, 0.4);
  --text: #e6f1ff;
  --text-2: #8ba3c7;
  --muted: #5a7093;
  --success: #10b981;
  --error: #f44336;
  --menu-width: 270px;
  --navbar-height: 64px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', 'Public Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, #020617 0%, #0a1628 50%, #020617 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

.glass {
  background: rgba(10, 22, 40, 0.75);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
}

.layout-wrapper { min-height: 100vh; min-height: 100dvh; }

/* ===================== SIDEBAR ===================== */
.layout-menu {
  position: fixed;
  top: 0; left: 0;
  width: var(--menu-width);
  height: 100vh;
  height: 100dvh;
  background: rgba(10, 22, 40, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s var(--ease-spring);
  overflow: hidden;
  will-change: transform;
  transform: translateZ(0);
  padding-left: env(safe-area-inset-left);
}
.app-brand {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  padding-top: calc(18px + env(safe-area-inset-top));
}
.app-brand::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-3), transparent);
  opacity: 0.6;
}
.app-brand-link { display: flex; align-items: center; gap: 12px; width: 100%; }
.app-brand-logo {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 0 20px var(--glow);
  transition: all 0.3s ease;
}
.app-brand-link:hover .app-brand-logo {
  transform: rotate(-5deg) scale(1.05);
  box-shadow: 0 0 28px var(--glow);
}
.app-brand-text {
  font-size: 1rem; font-weight: 800;
  letter-spacing: 1px; color: var(--text);
  white-space: nowrap; line-height: 1.2;
}
.app-brand-text small {
  display: block;
  font-size: 0.65rem; font-weight: 500;
  color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase; margin-top: 2px;
}

.menu-inner {
  padding: 12px 10px 20px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.menu-inner::-webkit-scrollbar { width: 4px; }
.menu-inner::-webkit-scrollbar-track { background: transparent; }
.menu-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.menu-inner::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.nav-section-title {
  padding: 14px 12px 8px;
  color: var(--accent-3);
  font-size: 0.68rem; font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
}
.nav-section-title:first-child { padding-top: 6px; }
.nav-section-title::after {
  content: '';
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.35;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.88rem; font-weight: 500;
  transition: all 0.2s var(--ease-smooth);
  position: relative; overflow: hidden;
  cursor: pointer; margin-bottom: 2px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.nav-item::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px; height: 60%;
  background: linear-gradient(180deg, var(--accent-3), var(--accent-2));
  border-radius: 0 4px 4px 0;
  transition: transform 0.25s ease;
}
.nav-item:hover, .nav-item:focus-visible {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-3);
}
.nav-item:active {
  background: rgba(59, 130, 246, 0.15);
  transform: scale(0.98);
}
.nav-item:hover::before { transform: translateY(-50%) scaleY(1); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.02) 100%);
  color: var(--accent-3);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}
.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
  box-shadow: 0 0 12px var(--accent);
}
.nav-item > i {
  width: 18px;
  flex-shrink: 0;
  font-size: 15px;
  text-align: center;
  transition: all 0.2s ease;
}
.nav-item:hover > i { transform: scale(1.1); }
.nav-item .nav-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item.has-submenu .nav-arrow {
  font-size: 11px;
  transition: transform 0.25s ease;
  margin-left: auto; flex-shrink: 0; opacity: 0.7;
}
.nav-item.has-submenu.open .nav-arrow { transform: rotate(180deg); }

.badge-accent {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--accent-3);
}
.badge-accent:hover {
  background: rgba(59, 130, 246, 0.18) !important;
  color: var(--accent-3) !important;
}
.badge-accent::before {
  background: linear-gradient(180deg, var(--accent-3), var(--accent-2)) !important;
}

.submenu {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s var(--ease-smooth);
  padding-left: 10px; margin: 0;
}
.submenu.open { max-height: 500px; padding: 4px 0 6px 10px; }
.submenu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 0.83rem; font-weight: 500;
  transition: all 0.2s ease;
  position: relative; margin-bottom: 2px; cursor: pointer;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.submenu-item::before {
  content: '';
  position: absolute; left: -10px; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.submenu-item:hover { background: rgba(59, 130, 246, 0.06); color: var(--accent-3); padding-left: 16px; }
.submenu-item:active { background: rgba(59, 130, 246, 0.14); }
.submenu-item:hover::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.submenu-item > i {
  width: 14px;
  flex-shrink: 0;
  font-size: 12px;
  text-align: center;
  opacity: 0.9;
}

.side-footer {
  padding: 12px 18px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.5);
  flex-shrink: 0;
}
.side-footer-status {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.7rem; color: var(--muted); margin-bottom: 6px;
}
.side-footer-status .status-left {
  display: flex; align-items: center; gap: 6px;
  color: var(--success); font-weight: 600; letter-spacing: 0.5px;
}
.side-footer-status .status-left::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}
.side-footer-version {
  display: flex; justify-content: space-between;
  font-size: 0.65rem; color: var(--muted); letter-spacing: 1px;
}
.side-footer-version span:last-child { color: var(--accent-3); font-weight: 600; }

/* ===================== LAYOUT PAGE ===================== */
.layout-page {
  margin-left: var(--menu-width);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* ===================== TOP HEADER ===================== */
.layout-navbar {
  position: sticky; top: 0;
  z-index: 999;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--navbar-height);
  padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  background: rgba(10, 22, 40, 0.75);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.navbar-left { display: flex; align-items: center; gap: 10px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: 10px;
  color: var(--text-2);
  position: relative;
  transition: all 0.2s var(--ease-smooth);
  border: 1px solid transparent;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-icon:hover, .btn-icon:focus-visible {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-3);
  border-color: var(--border);
}
.btn-icon:active {
  transform: scale(0.92);
  background: rgba(59, 130, 246, 0.18);
}
.navbar-toggle { display: none; }

.navbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cart-btn .badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 8px var(--glow);
}

.btn-header {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem; font-weight: 600;
  transition: all 0.2s var(--ease-smooth);
  letter-spacing: 0.3px;
  white-space: nowrap;
  min-height: 42px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-header i { font-size: 13px; }
.btn-header-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-header-outline:hover {
  border-color: var(--accent);
  color: var(--accent-3);
  background: rgba(59, 130, 246, 0.08);
}
.btn-header-outline:active {
  background: rgba(59, 130, 246, 0.15);
  transform: scale(0.96);
}
.btn-header-primary {
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 16px var(--glow);
}
.btn-header-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--glow); }
.btn-header-primary:active { transform: scale(0.96); box-shadow: 0 2px 8px var(--glow); }

/* ===================== CONTENT ===================== */
.content-wrapper {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 24px 20px 0;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.container-p-y {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 0 20px;
}
.row { width: 100%; display: flex; justify-content: center; }

/* ===================== AUTH VIEW ===================== */
.auth-view {
  width: 100%;
  max-width: 440px;
  display: block;
  position: relative;
  animation: viewIn 0.45s var(--ease-smooth);
}
.auth-view[hidden] { display: none !important; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-view::before {
  content: '';
  position: absolute;
  inset: -60px -40px;
  background:
    radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.25), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(37, 99, 235, 0.2), transparent 55%);
  filter: blur(60px);
  z-index: -1;
  opacity: 0.85;
  pointer-events: none;
  animation: auroraFloat 10s ease-in-out infinite;
}
@keyframes auroraFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.85; }
  50%      { transform: translateY(-12px) scale(1.05); opacity: 1; }
}

/* ===================== CARD WRAP ===================== */
.auth-card-wrap {
  position: relative;
  padding: 1.5px;
  border-radius: 22px;
  background: linear-gradient(135deg,
    rgba(96, 165, 250, 0.55) 0%,
    rgba(30, 58, 95, 0.35) 35%,
    rgba(30, 58, 95, 0.35) 65%,
    rgba(96, 165, 250, 0.55) 100%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 60px rgba(59, 130, 246, 0.15);
  animation: cardIn 0.55s var(--ease-spring);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===================== AUTH CARD ===================== */
.auth-card {
  width: 100%;
  background:
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.10), transparent 60%),
    linear-gradient(160deg, rgba(13, 27, 48, 0.98) 0%, rgba(10, 22, 40, 0.99) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 20.5px;
  padding: 32px 26px 26px;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(96, 165, 250, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0.7;
  mask-image: radial-gradient(circle at 50% 0%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, black 0%, transparent 75%);
}
.auth-card::after {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.18), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

.auth-card-head {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--accent-3);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  border-radius: 22px;
  margin-bottom: 14px;
  box-shadow:
    0 0 20px rgba(59, 130, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.auth-badge i { font-size: 10px; filter: drop-shadow(0 0 6px var(--glow)); }
.auth-card-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.5;
}
.auth-card-title strong {
  color: var(--accent-3);
  font-weight: 700;
}

/* ===================== ERROR / SUCCESS (đã fix gạch đỏ) ===================== */
.error-msg, .success-msg {
  display: none;              /* ← Ẩn hoàn toàn khi rỗng */
  border-radius: 10px;
  font-size: 0.85rem;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  position: relative;
  z-index: 1;
  animation: viewIn 0.3s ease;
}
.error-msg.show {
  display: block;             /* ← Chỉ hiện khi có class .show */
  color: var(--error);
  background: rgba(244, 67, 54, 0.06);
  border-color: rgba(244, 67, 54, 0.3);
}
.success-msg.show {
  display: block;             /* ← Chỉ hiện khi có class .show */
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.float-field {
  position: relative;
  margin-bottom: 18px;
  z-index: 1;
}
.field-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-3);
  font-size: 15px;
  pointer-events: none;
  z-index: 2;
  transition: all 0.25s ease;
}
.float-field input {
  width: 100%;
  padding: 24px 44px 8px 46px;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 16px;
  min-height: 64px;
  transition: all 0.25s var(--ease-smooth);
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.float-field input:focus {
  outline: none;
  background: #16263f;
  border-color: var(--accent-3);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.12),
    0 0 28px var(--glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.float-field label {
  position: absolute;
  left: 46px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
  transition: all 0.25s var(--ease-smooth);
  letter-spacing: 0;
  z-index: 1;
}
.float-field input:focus ~ label,
.float-field input:not(:placeholder-shown) ~ label {
  top: 15px;
  transform: translateY(0);
  font-size: 0.63rem;
  color: var(--accent-3);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 700;
}
.float-field input:focus ~ .field-icon {
  color: var(--accent);
  transform: translateY(-50%) scale(1.15);
  filter: drop-shadow(0 0 6px var(--glow));
}

.field-action {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 14px;
  transition: all 0.2s var(--ease-smooth);
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.field-action:hover { color: var(--accent-3); background: rgba(59, 130, 246, 0.1); }
.field-action:active { transform: translateY(-50%) scale(0.9); }

/* ===================== CAPTCHA ===================== */
.captcha-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-3);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-left: 2px;
  position: relative;
  z-index: 1;
}
.captcha-field-label i { font-size: 10px; filter: drop-shadow(0 0 6px var(--glow)); }

.captcha-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.captcha-visual {
  flex-shrink: 0;
  width: 190px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a1220;
  position: relative;
  transition: all 0.25s var(--ease-smooth);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.captcha-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 24px rgba(59, 130, 246, 0.18);
  pointer-events: none;
  transition: box-shadow 0.25s ease;
}
.captcha-visual:hover {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.12),
    0 0 24px var(--glow);
}
.captcha-visual:hover::after {
  box-shadow: inset 0 0 30px rgba(59, 130, 246, 0.28);
}
.captcha-visual:active { transform: scale(0.98); }
.captcha-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}
.captcha-visual::before {
  content: '\f021';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  color: rgba(96, 165, 250, 0.5);
  z-index: 2;
  pointer-events: none;
  transition: color 0.25s ease;
}
.captcha-visual:hover::before { color: var(--accent-3); }

.captcha-input-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}
.captcha-input-wrap input {
  width: 100%;
  height: 100%;
  padding: 0 46px 0 16px;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  transition: all 0.25s var(--ease-smooth);
  -webkit-appearance: none;
  appearance: none;
  min-height: 60px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.captcha-input-wrap input::placeholder {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  font-size: 0.8rem;
}
.captcha-input-wrap input:focus {
  outline: none;
  background: #16263f;
  border-color: var(--accent-3);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.12),
    0 0 28px var(--glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.captcha-refresh {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 14px;
  transition: all 0.2s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
  z-index: 3;
}
.captcha-refresh:hover {
  color: var(--accent-3);
  background: rgba(59, 130, 246, 0.1);
}
.captcha-refresh:active {
  transform: translateY(-50%) scale(0.9);
}
.captcha-refresh.spinning i {
  animation: spin 0.7s ease;
}
@keyframes spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* ===================== BUTTON ===================== */
.btn-auth {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff;
  font-size: 0.95rem; font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-radius: 14px;
  box-shadow:
    0 8px 28px var(--glow),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all 0.25s var(--ease-smooth);
  min-height: 56px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 4px;
  z-index: 1;
}
.btn-auth::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%);
  transition: left 0.75s ease;
}
.btn-auth:hover:not(:disabled)::before { left: 100%; }
.btn-auth:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 14px 40px rgba(59, 130, 246, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-auth:active:not(:disabled) {
  transform: scale(0.98) translateY(0);
  box-shadow:
    0 4px 14px var(--glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-auth:disabled { opacity: 0.75; cursor: not-allowed; }
.btn-auth i { font-size: 14px; transition: transform 0.25s var(--ease-spring); }
.btn-auth:hover:not(:disabled) i { transform: translateX(4px); }

.auth-link {
  text-align: center;
  color: var(--text-2);
  font-size: 0.88rem;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}
.auth-link a {
  color: var(--accent-3); font-weight: 700;
  transition: all 0.2s; cursor: pointer;
  padding: 8px 4px;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.auth-link a::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 4px; right: 4px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent-2));
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.auth-link a:hover::after { transform: scaleX(1); }
.auth-link a:hover, .auth-link a:active { color: #fff; text-shadow: 0 0 12px var(--glow); }

.auth-trust {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.6px;
  font-weight: 600;
  text-transform: uppercase;
}
.trust-item i { font-size: 11px; color: var(--accent-3); }
.trust-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.alert-info {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 16px;
  color: var(--accent-3);
  font-size: 0.78rem; line-height: 1.55;
  position: relative;
  z-index: 1;
}
.alert-info::before {
  content: '\f05a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-right: 6px;
  color: var(--accent-3);
}

.key-warning-title {
  color: var(--accent-3); font-weight: 800;
  font-size: 0.85rem; text-align: center;
  margin-bottom: 6px; letter-spacing: 0.3px;
  position: relative;
  z-index: 1;
}
.key-warning-sub {
  color: var(--text-2); font-size: 0.8rem;
  text-align: center; margin-bottom: 20px; line-height: 1.5;
  position: relative;
  z-index: 1;
}
.key-display {
  background: #0a1220;
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  color: var(--accent-3);
  margin: 0 0 16px;
  word-break: break-all;
  box-shadow: 0 0 24px var(--glow), inset 0 0 24px rgba(59, 130, 246, 0.05);
  position: relative; overflow: hidden;
  letter-spacing: 0.5px; line-height: 1.6;
  min-height: 64px;
  user-select: all;
  -webkit-user-select: all;
  z-index: 1;
}
.key-display::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), transparent);
  pointer-events: none;
}
.btn-group { display: flex; gap: 10px; margin-top: 4px; position: relative; z-index: 1; }
.btn-copy, .btn-login-link {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  transition: all 0.2s var(--ease-smooth);
  letter-spacing: 0.5px;
  min-height: 50px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-copy {
  background: var(--bg-2);
  border: 1.5px solid var(--accent);
  color: var(--accent-3);
}
.btn-copy:hover {
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}
.btn-copy:active { transform: scale(0.96); }
.btn-login-link {
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px var(--glow);
}
.btn-login-link:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(59, 130, 246, 0.55); }
.btn-login-link:active { transform: scale(0.96); }
.btn-copy i, .btn-login-link i { font-size: 14px; }

.copy-msg {
  font-size: 0.78rem; color: var(--accent-3);
  margin-top: 8px; text-align: center; font-weight: 600;
  animation: viewIn 0.3s ease;
  position: relative;
  z-index: 1;
}

.content-footer {
  padding: 16px 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  margin-top: auto;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.content-footer .brand-accent { color: var(--accent-3); font-weight: 600; }

.auth-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.auth-modal-overlay.show { opacity: 1; visibility: visible; }
.auth-modal {
  width: 100%; max-width: 420px;
  background: linear-gradient(160deg, #0d1b30 0%, #0a1628 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 26px 24px;
  position: relative; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(59, 130, 246, 0.08);
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: transform 0.4s var(--ease-spring), opacity 0.3s ease;
}
.auth-modal-overlay.show .auth-modal { transform: scale(1) translateY(0); opacity: 1; }
.auth-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: all 0.2s;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
.auth-modal-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.auth-modal-close:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.1); }
.auth-modal-icon {
  width: 76px; height: 76px;
  margin: 0 auto 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-3);
  font-size: 32px;
}
.auth-modal-title {
  text-align: center;
  font-size: 1.3rem; font-weight: 800;
  letter-spacing: 0.5px; color: var(--text);
  margin-bottom: 10px;
}
.auth-modal-desc {
  text-align: center; color: var(--text-2);
  font-size: 0.9rem; line-height: 1.6;
  margin-bottom: 26px; padding: 0 6px;
}
.auth-modal-desc strong { color: var(--accent-3); font-weight: 600; }
.auth-modal-actions { display: flex; gap: 10px; }
.auth-modal-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 10px;
  font-size: 0.9rem; font-weight: 700;
  transition: all 0.2s var(--ease-smooth);
  letter-spacing: 0.5px;
  min-height: 50px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.auth-modal-btn i { font-size: 14px; }
.auth-modal-btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.auth-modal-btn-cancel:hover {
  border-color: var(--accent);
  color: var(--accent-3);
  background: rgba(59, 130, 246, 0.06);
}
.auth-modal-btn-cancel:active { transform: scale(0.96); }
.auth-modal-btn-primary {
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px var(--glow);
}
.auth-modal-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(59, 130, 246, 0.6); }
.auth-modal-btn-primary:active { transform: scale(0.96); box-shadow: 0 2px 12px var(--glow); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.layout-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.layout-overlay.show { opacity: 1; visibility: visible; }

/* ===================== TABLET ===================== */
@media (max-width: 1199px) {
  .layout-menu {
    transform: translateX(-100%);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }
  .layout-menu.show { transform: translateX(0); }
  .layout-page { margin-left: 0; }
  .navbar-toggle { display: inline-flex; }
}

/* ===================== MOBILE ===================== */
@media (max-width: 768px) {
  :root {
    --menu-width: 280px;
    --navbar-height: 58px;
  }

  .glass, .layout-navbar, .auth-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .layout-menu {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(10, 22, 40, 0.99);
  }

  .layout-menu { transition: transform 0.4s var(--ease-spring); }

  .layout-navbar {
    height: var(--navbar-height);
    padding: 0 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    font-size: 15px;
  }

  .cart-btn { display: none; }

  .btn-header {
    padding: 10px 12px;
    gap: 0;
    min-height: 40px;
    border-radius: 9px;
  }
  .btn-header span { display: none; }
  .btn-header i { font-size: 15px; }

  .content-wrapper {
    padding: 12px 12px 0;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .container-p-y {
    padding: 16px 0 12px;
    align-items: flex-start;
  }

  .auth-card {
    padding: 26px 20px 22px;
    border-radius: 18.5px;
  }
  .auth-card-wrap { border-radius: 20px; }
  .auth-card-head { margin-bottom: 20px; }
  .auth-badge { font-size: 0.58rem; padding: 5px 12px; }
  .auth-card-title { font-size: 0.95rem; }

  .float-field input {
    padding: 22px 42px 8px 44px;
    min-height: 60px;
  }
  .field-icon { left: 15px; }
  .float-field label { left: 44px; }
  .field-action { width: 36px; height: 36px; right: 10px; }

  .captcha-visual {
    width: 150px;
    height: 56px;
    border-radius: 12px;
  }
  .captcha-visual::after { border-radius: 12px; }
  .captcha-input-wrap input {
    min-height: 56px;
    border-radius: 12px;
    padding: 0 44px 0 14px;
  }
  .captcha-refresh { width: 34px; height: 34px; right: 8px; }

  .btn-auth {
    padding: 15px;
    min-height: 54px;
    font-size: 0.9rem;
  }

  .key-display {
    padding: 16px;
    font-size: 0.95rem;
  }
  .key-warning-title { font-size: 0.8rem; }
  .key-warning-sub { font-size: 0.76rem; }

  .btn-group {
    flex-direction: column;
    gap: 8px;
  }
  .btn-copy, .btn-login-link {
    width: 100%;
    min-height: 50px;
  }

  .auth-trust { margin-top: 20px; padding-top: 18px; }

  .content-footer {
    padding: 14px 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    font-size: 0.74rem;
  }

  .auth-modal-overlay { padding: 16px; }
  .auth-modal {
    padding: 28px 22px 22px;
    border-radius: 18px;
  }
  .auth-modal-icon {
    width: 68px;
    height: 68px;
    font-size: 28px;
    margin-bottom: 16px;
  }
  .auth-modal-title { font-size: 1.15rem; }
  .auth-modal-desc { font-size: 0.86rem; margin-bottom: 22px; }
  .auth-modal-actions { flex-direction: column-reverse; }
  .auth-modal-btn { width: 100%; }
}

/* ===================== SMALL MOBILE ===================== */
@media (max-width: 400px) {
  :root { --menu-width: 260px; }
  .auth-card { padding: 22px 16px 18px; }
  .auth-card-title { font-size: 0.88rem; }
  .auth-trust { font-size: 0.65rem; }
  .trust-item { font-size: 0.62rem; }
  .key-display { font-size: 0.88rem; padding: 14px; }

  .captcha-wrap {
    flex-direction: column;
  }
  .captcha-visual {
    width: 100%;
    height: 60px;
  }
  .captcha-input-wrap input {
    min-height: 54px;
  }
}

/* ===================== LANDSCAPE MOBILE ===================== */
@media (max-height: 500px) and (orientation: landscape) {
  .container-p-y { align-items: flex-start; padding: 12px 0; }
  .auth-card { padding: 16px 20px 14px; }
  .auth-card-head { margin-bottom: 14px; }
  .btn-auth { min-height: 46px; padding: 12px; }
  .float-field input { min-height: 52px; padding: 20px 42px 6px 44px; }
  .captcha-visual { height: 52px; }
  .captcha-input-wrap input { min-height: 52px; }
}

/* ===================== REDUCE MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .layout-menu { transition: none; }
  .auth-card-wrap, .auth-view, .auth-view::before { animation: none; }
}

/* ===================== HOVER-CAPABLE ONLY ===================== */
@media (hover: none) {
  .nav-item:hover { background: transparent; color: var(--text-2); }
  .nav-item:hover::before { transform: translateY(-50%) scaleY(0); }
  .nav-item.active { background: linear-gradient(90deg, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.02) 100%); }
  .nav-item.active::before { transform: translateY(-50%) scaleY(1); }
  .submenu-item:hover { padding-left: 12px; background: transparent; color: var(--text-2); }
  .submenu-item:hover::before { background: var(--border); box-shadow: none; }
  .btn-header-primary:hover { transform: none; }
  .btn-auth:hover:not(:disabled) { transform: none; }
  .btn-auth:hover:not(:disabled)::before { left: -100%; }
  .btn-auth:hover:not(:disabled) i { transform: none; }
  .btn-copy:hover { transform: none; }
  .btn-login-link:hover { transform: none; }
  .auth-modal-btn-primary:hover { transform: none; }
  .app-brand-link:hover .app-brand-logo { transform: none; }
  .nav-item:hover > i { transform: none; }
  .auth-link a:hover::after { transform: scaleX(0); }
  .captcha-visual:hover { transform: none; }
  .captcha-visual:hover::before { color: rgba(96, 165, 250, 0.5); }
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #020617; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-3); }
::selection { background: var(--accent-3); color: #fff; }