/* --- Core palette (tweak --nexus-* only) --- */
:root,
html.dark,
.dark {
  --nexus-void: #03050a;
  --nexus-surface: #0a101c;
  --nexus-surface-2: #0f1728;
  --nexus-surface-3: #141f33;
  --nexus-cyan: #00e5ff;
  --nexus-cyan-dim: #00a8bc;
  --nexus-magenta: #ff2d92;
  --nexus-violet: #8b5cff;
  --nexus-text: #e8f4ff;
  --nexus-text-soft: #9db4cc;
  --nexus-grid: rgba(0, 229, 255, 0.04);

  /* style4 shop tokens (names kept for compatibility) */
  --main-white-color: var(--nexus-surface);
  --main-bg-color: var(--nexus-void);
  --main-white-gray-color: var(--nexus-surface-2);
  --header-background: rgba(8, 12, 22, 0.92);
  --main-text-color: var(--nexus-text);
  --text-body: #c4d6ea;
  --text-muted: #6b849e;
  --muted-2: #5a7390;
  --muted-heading: #7ee8ff;
  --muted-desc: #8aa3bc;
  --muted-3: #1e2a3d;
  --muted-4: #243044;
  --muted-5: #2c3a52;
  --muted-6: #a3b8cc;
  --main-dark-color: #f0fbff;
  --dark-2: #d0e4f5;
  --bg-muted: var(--nexus-surface-2);
  --panel-bg: #0c121f;
  --panel-bg-2: #152030;
  --border-muted: #2a3d55;
  --warning-color: #ffd447;
  --info-color: var(--nexus-cyan);
  --error-color: #ff4d6a;
  --success-color: #00ffa3;
  --accent: var(--nexus-magenta);
  --accent-2: #ffb86c;
  --info-bg: rgba(0, 229, 255, 0.08);
  --info-text: #9cf0ff;
  --text-opaque: rgba(232, 244, 255, 0.92);
  --garland-green: #00ff9d;

  /* Tailwind / shadcn (app bundle) */
  --background: #03050a;
  --foreground: #e8f4ff;
  --card: #0a101c;
  --card-foreground: #e8f4ff;
  --popover: #0f1728;
  --popover-foreground: #e8f4ff;
  --primary: #00e5ff;
  --primary-foreground: #03050a;
  --secondary: #152030;
  --secondary-foreground: #e8f4ff;
  --muted: #141f33;
  --muted-foreground: #8aa3bc;
  --accent: #1a2540;
  --accent-foreground: #e8f4ff;
  --destructive: #ff4d6a;
  --destructive-foreground: #fff;
  --border: rgba(0, 229, 255, 0.18);
  --input: #1e2a3d;
  --ring: #00e5ff;
  --radius: 0.5rem;
  --sidebar-background: #080d18;
  --sidebar-foreground: #e8f4ff;
  --sidebar-primary: #00e5ff;
  --sidebar-primary-foreground: #03050a;
  --sidebar-accent: #141f33;
  --sidebar-accent-foreground: #e8f4ff;
  --sidebar-border: rgba(0, 229, 255, 0.15);
  --sidebar-ring: #00e5ff;
  --sidebar: #080d18;
}

html {
  color-scheme: dark;
}

.app-wrapper,
.navbar,
.modal,
.product-card,
.recharge-panel,
.profile-sidebar__list,
input,
select,
textarea,
button {
  font-family: "Rajdhani", "Manrope", system-ui, sans-serif;
}

/* Scan grid + vignette on page shell */
.app-wrapper {
  background-color: var(--nexus-void);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 229, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(139, 92, 255, 0.08), transparent 45%),
    linear-gradient(var(--nexus-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--nexus-grid) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  /* fixed ломает position:fixed у модалок внутри #app в Chrome/WebKit */
  background-attachment: scroll;
}

.wrapper {
  position: relative;
}

.wrapper::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(3, 5, 10, 0.65) 100%);
}

.wrapper > * {
  position: relative;
  z-index: 1;
}

/* Nav */
.navbar {
  background: linear-gradient(180deg, rgba(12, 20, 36, 0.98) 0%, rgba(6, 10, 18, 0.95) 100%);
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-top: none;
  box-shadow:
    0 0 0 1px rgba(139, 92, 255, 0.08),
    0 8px 40px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(0, 229, 255, 0.06);
  backdrop-filter: blur(12px);
}

.navbar-brand {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nexus-text);
  text-shadow:
    0 0 20px rgba(0, 229, 255, 0.45),
    0 0 40px rgba(139, 92, 255, 0.2);
}

.nav-item:hover {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.12), rgba(139, 92, 255, 0.08)) !important;
  color: var(--nexus-cyan) !important;
  box-shadow: inset 0 -2px 0 rgba(0, 229, 255, 0.5);
}

.auth-btn:hover,
.balance-btn:hover,
.profile-btn:hover {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.15), rgba(255, 45, 146, 0.08)) !important;
  color: var(--nexus-cyan) !important;
}

/* Category / server chips */
.app-button {
  background: rgba(15, 23, 40, 0.9) !important;
  color: var(--nexus-text) !important;
  border: 1px solid rgba(0, 229, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
}

.app-button:hover,
.app-button--active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(139, 92, 255, 0.15)) !important;
  color: var(--nexus-cyan) !important;
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow:
    0 0 24px rgba(0, 229, 255, 0.15),
    inset 0 0 20px rgba(0, 229, 255, 0.05);
}

/* Product cards — картинка → цена → название → кнопка */
.product-card {
  position: relative;
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  aspect-ratio: auto !important;
  cursor: pointer;
  background: linear-gradient(165deg, rgba(18, 28, 48, 0.95) 0%, rgba(8, 12, 22, 0.98) 100%) !important;
  border: 1px solid rgba(0, 229, 255, 0.15);
  box-shadow:
    0 0 0 1px rgba(139, 92, 255, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.5);
}

.product-card:focus-visible {
  outline: 2px solid var(--nexus-cyan);
  outline-offset: 3px;
}

.product-card:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.25),
    0 16px 48px rgba(0, 229, 255, 0.1);
}

/* Футер: цена → название → кнопка «Выбрать товар» */
.product-card-footer {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  flex: 0 0 auto !important;
  gap: 8px 0 !important;
  min-height: auto !important;
  max-height: none !important;
  height: auto !important;
  padding: 10px 12px 12px !important;
  color: var(--nexus-text) !important;
  background: linear-gradient(180deg, rgba(2, 6, 14, 0.55) 0%, rgba(3, 8, 18, 0.97) 100%) !important;
  border-top: 1px solid rgba(0, 229, 255, 0.28) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.product-card-footer::after {
  content: "Выбрать товар";
  order: 3;
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: #03050a;
  background: linear-gradient(90deg, var(--nexus-cyan), #5cf0ff);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.3);
  box-sizing: border-box;
  pointer-events: none;
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover .product-card-footer::after,
.product-card:focus-visible .product-card-footer::after {
  filter: brightness(1.08);
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.45);
}

.product-card-name {
  order: 2;
  width: 100%;
  max-width: 100% !important;
  font-size: clamp(0.8125rem, 1.2vw, 0.9375rem) !important;
  line-height: 1.35 !important;
  font-weight: 600 !important;
  color: var(--nexus-text) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  text-align: left;
  word-break: break-word;
  hyphens: auto;
}

.product-card-price {
  order: 1;
  align-self: flex-end;
  width: 100%;
  text-align: right;
  line-height: 1.2;
  color: var(--nexus-cyan) !important;
  font-family: "Orbitron", sans-serif;
  font-weight: 700 !important;
  font-size: clamp(1rem, 1.45vw, 1.15rem) !important;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
  white-space: nowrap;
}

.product-card-discount-price,
.product-card-old-price {
  order: 1;
  align-self: flex-end;
  width: 100%;
  text-align: right;
  font-size: 0.8125rem !important;
}

/* Превью товара — только картинка, без кнопки поверх */
.product-card-image-container {
  position: relative;
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 140px;
  max-height: none !important;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 50% 80%, rgba(0, 229, 255, 0.06), transparent 55%),
    linear-gradient(180deg, rgba(15, 23, 40, 0.5) 0%, transparent 100%) !important;
}

.product-card-image-container img {
  position: relative;
  z-index: 0;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Modals */
.modal {
  background: linear-gradient(180deg, #0f1728 0%, #080d18 100%) !important;
  border: 1px solid rgba(0, 229, 255, 0.25);
  box-shadow:
    0 0 0 1px rgba(139, 92, 255, 0.12),
    0 24px 80px rgba(0, 0, 0, 0.65),
    0 0 80px rgba(0, 229, 255, 0.08);
}

/* Окно товара: по центру экрана, не в конце длинной страницы */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  max-width: none !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  z-index: 2147483000 !important;
  background: rgba(2, 4, 10, 0.88) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-overlay .modal {
  position: relative;
  flex-shrink: 0;
  margin-block: auto;
  margin-inline: auto;
}

.modal-primary-button {
  background: linear-gradient(90deg, var(--nexus-cyan), var(--nexus-violet)) !important;
  border: none;
}

.modal-primary-button .modal-primary-button-text,
.modal-primary-button-text {
  color: #03050a !important;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.06em;
}

.product-modal-title {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  color: var(--nexus-cyan) !important;
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.35);
}

/* Banners */
.banner-elem {
  border: 1px solid rgba(0, 229, 255, 0.15);
  background: rgba(12, 20, 36, 0.6);
}

.bunner-title {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.06em;
}

/* Search */
.search-input,
.text-input {
  background: rgba(8, 14, 26, 0.9) !important;
  border: 1px solid rgba(0, 229, 255, 0.2);
  color: var(--nexus-text) !important;
}

.search-input:focus,
.text-input:focus {
  border-color: var(--nexus-cyan) !important;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}

/* Footer */
.footer-link {
  color: var(--nexus-cyan) !important;
}

.footer-link:hover {
  color: var(--nexus-magenta) !important;
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--nexus-void);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--nexus-cyan-dim), var(--nexus-violet));
  border-radius: 999px;
  border: 2px solid var(--nexus-void);
}

::selection {
  background: rgba(0, 229, 255, 0.35);
  color: #fff;
}

/*
 * Сообщения «купил» / «не хватает денег» (style4: .toast-container + .toast).
 * Баг: --main-white-color тёмный, а style4 красит им текст тоста → не видно за модалкой.
 */
.toast-container {
  z-index: 2147483001 !important;
}

.toast {
  color: var(--nexus-text) !important;
  font-weight: 600 !important;
}

.toast.success {
  color: #03050a !important;
}

.toast.error {
  color: #fff !important;
}

.toast.info {
  color: #03050a !important;
}

.toast.warning {
  color: #03050a !important;
}