/* =========================================================
   NOVAX CLIENT - CYBERPUNK DARK THEME
   Style, Form & Typography inspired by Aimhack
   Optimized with NovaX signature aesthetics
   ========================================================= */

@font-face {
  font-family: 'NovaXTektur';
  src: url('../fonts/Tektur.ttf') format('truetype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-main: #08090b;
  --bg-card: #0f1116;
  --bg-card-gradient: linear-gradient(135deg, #121316 0%, #0c0d10 100%);
  --border-line: #242730;
  --border-light: #2e3444;
  
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-blue-glow: rgba(59, 130, 246, 0.4);
  --accent-blue-subtle: #1e3a8a33;
  --accent-blue-text: #93c5fd;
  
  --text-main: #f1f2f6;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --text-dark: #090a0c;
  
  --btn-white: #ededee;
  --btn-white-hover: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body.nx-body {
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color-scheme: dark;
}

/* Scanline Overlay (Aimhack style) */
body.nx-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.22) 2px 3px);
  opacity: 0.28;
}

/* Background Nebula Glow */
.nx-background {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 25%, rgba(37, 99, 235, 0.08), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Container / Mobile-first Viewport */
.nx-viewport {
  position: relative;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  border-left: 1px solid #16181e;
  border-right: 1px solid #16181e;
  background: rgba(8, 9, 11, 0.95);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.85);
  z-index: 1;
}

.nx-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  min-height: 100dvh;
}

/* Top App Header */
.nx-header {
  height: 60px;
  min-height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
  background: rgba(8, 9, 11, 0.98);
  border-bottom: 1px solid #1b1e26;
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
}

.nx-brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nx-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #2563eb;
  box-shadow: 0 0 12px var(--accent-blue-glow);
}

.nx-header h1 {
  font-family: 'NovaXTektur', "Arial Black", sans-serif;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.8px;
  line-height: 1.1;
  color: var(--text-main);
  text-transform: uppercase;
}

.nx-header h1 span {
  color: var(--accent-blue);
}

.nx-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nx-icon-button, .nx-language {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-line);
  gap: 6px;
  background: #111317;
  color: #e9e9eb;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  padding: 6px 12px;
  font: 600 10px Consolas, monospace;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nx-icon-button:hover, .nx-language:hover {
  background: #191c24;
  border-color: var(--accent-blue);
  color: #ffffff;
}

/* Main Scrollable Content Area */
.nx-content {
  padding: 14px 16px 88px;
  flex: 1;
  overflow-y: auto;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: tabFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   PANELS & CARDS (Aimhack Chamfered Polygon Style)
   ========================================================= */

.nx-panel {
  position: relative;
  background: var(--bg-card-gradient);
  border: 1px solid var(--border-line);
  padding: 16px 16px;
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  text-align: left;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease;
}

.nx-panel:hover {
  border-color: var(--border-light);
}

/* Notice / Alert Card */
.nx-notice {
  border-left: 3px solid var(--accent-blue);
  background: #0d1527;
  color: var(--accent-blue-text);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 11.5px;
  line-height: 1.6;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  border-top: 1px solid #1e293b;
  border-right: 1px solid #1e293b;
  border-bottom: 1px solid #1e293b;
}

.nx-notice svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 2px;
  color: var(--accent-blue);
}

.nx-notice.bad {
  border-left-color: #ef4444;
  background: #211315;
  color: #fca5a5;
  border-color: #451a1e;
}

/* Sub-header step captions */
.nx-step-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px 4px;
  font: 700 10px Consolas, monospace;
  letter-spacing: 1.6px;
  color: #e2e3e7;
}

.nx-step-caption > span:last-child {
  color: var(--accent-blue);
  font-weight: 700;
}

/* Steps (1, 2, 3) */
.nx-step h2 {
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.4;
  font-family: 'NovaXTektur', "Arial Black", sans-serif;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.nx-step-number {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: #171920;
  border: 1px solid #2a2d39;
  font-size: 17px;
  font-weight: 900;
  color: #94a3b8;
  flex-shrink: 0;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  font-family: 'NovaXTektur', sans-serif;
}

.nx-step.current {
  border-color: #2b354c;
  background: linear-gradient(135deg, #131724 0%, #0c0d12 100%);
}

.nx-step.current .nx-step-number {
  background: #1e3a8a;
  border-color: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 0 12px var(--accent-blue-glow);
}

.nx-step p {
  color: var(--text-sub);
  font-size: 12px;
  margin: 12px 0 12px;
  line-height: 1.65;
}

.nx-instructions {
  margin: 12px 0 14px;
  padding-left: 0;
  list-style: none;
  color: var(--text-sub);
  font-size: 12px;
  line-height: 1.7;
}

.nx-instructions li {
  margin-bottom: 8px;
}

.nx-instructions li strong {
  color: var(--accent-blue);
  margin-right: 4px;
  font-family: Consolas, monospace;
}

/* =========================================================
   KEY & HWID INPUT FIELDS (Aimhack Polygon Geometry)
   ========================================================= */

.nx-field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

#activationForm > #activateButton {
  margin-top: 16px;
}

#activationMessage {
  margin-top: 12px;
  color: var(--text-sub);
  line-height: 1.6;
}

.nx-field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 10px Consolas, monospace;
  letter-spacing: 1.5px;
  color: #8b95a8;
  text-transform: uppercase;
}

.nx-field-label > i {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--accent-blue);
  box-shadow: 0 0 6px var(--accent-blue-glow);
}

.nx-key-input {
  height: 52px;
  background: #232836;
  padding: 1.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: all 0.15s ease;
}

.nx-key-input:focus-within {
  background: var(--accent-blue);
  box-shadow: 0 0 14px var(--accent-blue-glow);
}

.nx-key-input:before {
  content: "";
  position: absolute;
  inset: 1.5px;
  background: #0d0f14;
  clip-path: inherit;
  z-index: 0;
}

.nx-key-input > input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  position: relative;
  z-index: 1;
  border-radius: 0;
  color: #f1f5f9;
  font: 600 12.5px Consolas, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: none;
  padding: 12px 14px;
  outline: none;
}

.nx-key-input > input::placeholder {
  color: #4b5563;
  text-transform: none;
  font-size: 11.5px;
}

.nx-key-input > button {
  position: relative;
  z-index: 1;
  margin: 6px 8px;
  background: #161b26;
  color: #93c5fd;
  border: 1px solid #28344c;
  padding: 8px 12px;
  font: 700 10px Consolas, monospace;
  letter-spacing: 1px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nx-key-input > button:hover {
  background: #1e293b;
  border-color: var(--accent-blue);
  color: #ffffff;
}

.nx-key-input > button:active {
  transform: scale(0.96);
}

/* =========================================================
   BUTTONS (Aimhack Polygon Geometry)
   ========================================================= */

/* Primary Button (White with Cut Corners) */
.nx-primary {
  border: 0;
  min-height: 50px;
  padding: 14px 18px;
  background: var(--btn-white);
  color: var(--text-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  clip-path: polygon(11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%, 0 11px);
  font-family: 'NovaXTektur', "Arial Black", sans-serif;
  font-weight: 900;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.nx-primary:hover {
  background: var(--btn-white-hover);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.nx-primary:active {
  transform: scale(0.99);
}

/* Secondary Action Button (Dark with Cyan/Blue glow) */
.nx-secondary-action {
  border: 1px solid #2a3142;
  min-height: 50px;
  padding: 14px 18px;
  background: #11141c;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  clip-path: polygon(11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%, 0 11px);
  font-family: 'NovaXTektur', "Arial Black", sans-serif;
  font-weight: 900;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.nx-secondary-action:hover {
  border-color: var(--accent-blue);
  background: #161c28;
  color: #ffffff;
  box-shadow: 0 0 16px var(--accent-blue-glow);
}

.nx-secondary-action:active {
  transform: scale(0.99);
}

/* Secondary Subactions (iOS, Android, Config, QR...) */
.nx-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}

.nx-profile-actions button,
.nx-profile-actions a {
  border: 0;
  background: none;
  padding: 4px 0;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 10.5px Consolas, monospace;
  letter-spacing: 0.8px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.nx-profile-actions button:hover,
.nx-profile-actions a:hover {
  color: var(--accent-blue);
}

/* Subtext button */
.nx-text-button {
  border: 0;
  background: none;
  color: #8b95a5;
  padding: 12px 10px;
  font: 600 11px Consolas, monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
  width: 100%;
  transition: color 0.15s ease;
}

.nx-text-button:hover {
  color: var(--text-main);
}

.nx-subtext-muted {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  font-family: Consolas, monospace;
}

/* =========================================================
   MANAGEMENT TAB COMPONENTS
   ========================================================= */

.nx-label {
  font: 10px Consolas, monospace;
  text-transform: uppercase;
  color: #7b8598;
  letter-spacing: 1.5px;
}

.nx-status {
  padding: 3px 8px;
  font: 9px Consolas, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #60a5fa;
  background: #0f1c30;
  border: 1px solid #1e3a8a;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  white-space: nowrap;
}

.nx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nx-muted {
  color: var(--text-muted);
  font-size: 11px;
  font-family: Consolas, monospace;
}

.nx-device-info h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 10px 0 4px;
  font-weight: 900;
  text-transform: uppercase;
  font-family: 'NovaXTektur', sans-serif;
  color: var(--text-main);
}

.nx-device-info p {
  font-size: 11.5px;
  color: var(--text-sub);
}

/* Link Row Card (Hướng dẫn cài đặt / Happ / WireGuard) */
.nx-link-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-main);
  min-height: 60px;
  font-size: 13px;
  border: 1px solid var(--border-line);
  cursor: pointer;
  text-decoration: none;
  background: var(--bg-card-gradient);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  padding: 12px 16px;
  transition: all 0.15s ease;
}

.nx-link-row:hover {
  border-color: var(--accent-blue);
  background: linear-gradient(135deg, #151a26, #0e1118);
}

.nx-link-row > span {
  flex: 1;
}

.nx-link-row strong {
  font-size: 13px;
  font-weight: 900;
  display: block;
  font-family: 'NovaXTektur', sans-serif;
  letter-spacing: 0.8px;
}

.nx-link-row small {
  display: block;
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 3px;
}

.nx-link-icon-box {
  width: 36px;
  height: 36px;
  background: #151822;
  border: 1px solid #262c3e;
  display: grid;
  place-items: center;
  color: var(--accent-blue);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  flex-shrink: 0;
  font-size: 16px;
}

.nx-chevron-box {
  color: var(--text-muted);
  font-size: 18px;
}

/* VPN Switch Control */
.nx-connection .nx-row label {
  margin: 0;
  font-family: 'NovaXTektur', sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
}

.nx-connection > p {
  font-size: 11.5px;
  color: var(--text-sub);
  line-height: 1.6;
  margin-top: 8px;
}

.nx-switch {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
  display: block;
  margin: 0;
  cursor: pointer;
}

.nx-switch > input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.nx-switch > span {
  display: block;
  width: 100%;
  height: 100%;
  background: #1b1e28;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  transition: background 0.15s ease;
  border: 1px solid #2c3345;
}

.nx-switch > span:after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  background: #64748b;
  transition: transform 0.15s ease, background 0.15s ease;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.nx-switch > input:checked + span {
  background: #2563eb;
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px var(--accent-blue-glow);
}

.nx-switch > input:checked + span:after {
  background: #ffffff;
  transform: translateX(22px);
}

/* DNS Selector */
.nx-connection label.dns-title {
  font: 10px Consolas, monospace;
  letter-spacing: 1px;
  color: #8a94a6;
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.nx-connection select {
  width: 100%;
  background: #11141c;
  border: 1px solid #273042;
  color: var(--text-main);
  padding: 11px 14px;
  font: 500 12px Consolas, monospace;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.nx-connection select:focus {
  border-color: var(--accent-blue);
}

/* Time & Key Countdown Card */
.nx-time {
  font-family: 'NovaXTektur', sans-serif;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin: 12px 0 14px;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  text-shadow: 0 0 18px var(--accent-blue-glow);
}

.nx-key-masked {
  border-top: 1px dashed #222736;
  margin-top: 14px;
  padding-top: 12px;
  color: var(--text-sub);
  font: 11px Consolas, monospace;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nx-key-masked span:last-child {
  color: #60a5fa;
  font-weight: 700;
}

/* Reset / Logout Button */
.nx-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border: 1px solid #3f1e24;
  background: #1c1012;
  color: #fca5a5;
  text-transform: uppercase;
  font-family: 'NovaXTektur', sans-serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  margin-top: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nx-logout:hover {
  background: #2c1417;
  border-color: #ef4444;
  color: #ffffff;
}

/* =========================================================
   BOTTOM NAVIGATION BAR
   ========================================================= */

.nx-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-height: 68px;
  padding: 6px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid #212530;
  background: rgba(9, 10, 12, 0.96);
  backdrop-filter: blur(10px);
  z-index: 50;
}

.nx-nav-item {
  flex: 1;
  min-width: 0;
  width: 33.333%;
  border: 0;
  background: none;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 600 10px Consolas, monospace;
  letter-spacing: 1.4px;
  position: relative;
  padding: 10px 2px 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.nx-guide-card h2 {
  margin: 10px 0 12px;
  font-family: 'NovaXTektur', sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
  text-transform: none;
}

.nx-guide-card p {
  margin-bottom: 16px;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.75;
}

.nx-guide-number {
  color: var(--accent-blue-text);
  font: 700 10px Consolas, monospace;
  letter-spacing: 1.5px;
}

.nx-guide-video {
  display: block;
  width: 100%;
  max-height: 60vh;
  aspect-ratio: 6 / 13;
  object-fit: contain;
  background: #030509;
  border: 1px solid var(--border-line);
  border-radius: 10px;
}

.nx-nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.nx-nav-item.active {
  color: #f8fafc;
}

.nx-nav-item.active:before {
  content: "";
  position: absolute;
  top: -6px;
  left: 32%;
  width: 36%;
  height: 2px;
  background: var(--accent-blue);
  box-shadow: 0 0 12px var(--accent-blue);
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 82px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue-text);
  padding: 10px 20px;
  font: 600 11.5px Consolas, monospace;
  letter-spacing: 0.5px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

.toast-msg.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
