﻿/* ===================================
   PAY2WIN — DUAL THEME SUPPORT
   Исправленная версия с корректным переключением
   =================================== */

/* ===================================
   LIGHT THEME VARIABLES (default)
   =================================== */
:root {
  /* Background colors - warm cream palette */
  --color-bg-base: #FDFBF7;
  --color-bg-secondary: #F9F6F0;
  --color-bg-tertiary: #F4F0E8;
  --color-bg-card: #FFFFFF;
  --color-bg-elevated: #FFFFFF;
  
  /* Text colors */
  --color-text-primary: #4A4A4A;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #9A9A9A;
  --color-text-light: #FFFFFF;
  
  /* Accent colors */
  --color-accent-primary: #D9AA67;
  --color-accent-secondary: #7A6047;
  --color-accent-soft: #E8DCC8;
  --color-accent-hover: #E4B978;
  
  /* Border colors */
  --color-border: #E5E0D8;
  --color-border-strong: #D5D0C8;
  
  /* Semantic colors */
  --color-success: #7CB38B;
  --color-warning: #E5B86E;
  --color-error: #E58E8E;
  
  /* Shadows - light theme */
  --shadow-sm: 0 1px 3px rgba(74, 74, 74, 0.08);
  --shadow-md: 0 4px 12px rgba(74, 74, 74, 0.1);
  --shadow-lg: 0 8px 24px rgba(74, 74, 74, 0.12);
  --shadow-hover: 0 6px 20px rgba(74, 74, 74, 0.15);
  --shadow-inset: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  
  /* Gradients */
  --gradient-button: #D9AA67;
  --gradient-button-hover: #E4B978;
  --gradient-surface: linear-gradient(180deg, #FFFFFF 0%, #F9F6F0 100%);
}

/* ===================================
   DARK THEME VARIABLES
   Применяются ТОЛЬКО когда [data-theme="dark"]
   =================================== */
[data-theme="dark"] {
  /* Background colors - warm dark palette */
  --color-bg-base: #1a1816;
  --color-bg-secondary: #24221f;
  --color-bg-tertiary: #2d2a26;
  --color-bg-card: #35322e;
  --color-bg-elevated: #3d3a36;
  
  /* Text colors - warm light */
  --color-text-primary: #f5f0eb;
  --color-text-secondary: #d5cfc7;
  --color-text-muted: #9a948c;
  --color-text-light: #ffffff;
  
  /* Accent colors - warm amber/gold */
  --color-accent-primary: #D9AA67;
  --color-accent-secondary: #b88a5d;
  --color-accent-soft: rgba(217, 170, 103, 0.18);
  --color-accent-hover: #E4B978;
  
  /* Border colors */
  --color-border: #4a453f;
  --color-border-strong: #5c564f;
  
  /* Semantic colors */
  --color-success: #8bc99a;
  --color-warning: #f0c987;
  --color-error: #f0a0a0;
  
  /* Shadows - dark theme */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.6);
  --shadow-inset: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  
  /* Gradients */
  --gradient-button: #D9AA67;
  --gradient-button-hover: #E4B978;
  --gradient-surface: linear-gradient(180deg, #35322e 0%, #2d2a26 100%);
}

/* ===================================
   Base Styles
   =================================== */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-bg-base);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-boot *,
.theme-changing *,
.theme-boot *::before,
.theme-boot *::after,
.theme-changing *::before,
.theme-changing *::after {
  transition: none !important;
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text-primary);
  transition: color 0.3s ease;
}

h1 {
  font-size: 1.875rem;
  font-weight: 700;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

p {
  margin-top: 0;
  margin-bottom: 16px;
  line-height: 1.8;
  color: var(--color-text-secondary);
  transition: color 0.3s ease;
}

a {
  color: var(--color-accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-accent-hover);
}

/* ===================================
   Theme Toggle Button
   =================================== */
.theme-toggle {
  position: static;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  z-index: 1600;
  flex: 0 0 auto;
}

.theme-toggle-floating {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
}

.theme-toggle:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
  background: var(--color-bg-elevated);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* ===================================
   Header / Topbar
   =================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  background: var(--color-bg-card);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.topbar-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

.logo {
  width: auto;
  min-width: 0;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition: all 0.2s ease;
}

.logo-wordmark {
  display: inline-block;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.logo-icon {
  display: none !important;
}

.topbar > .logo {
  display: none !important;
}

.logo:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-primary);
  transform: translateY(-1px);
}

.search-bar {
  flex: 1;
  max-width: 480px;
  display: flex;
  gap: 6px;
}

.search-bar input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-bar input:focus {
  border-color: var(--color-accent-primary);
  background: var(--color-bg-card);
  box-shadow: 0 0 0 3px rgba(217, 170, 103, 0.15);
}

.search-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 999px;
  background: var(--color-accent-primary);
  color: var(--color-text-light);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

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

/* Game Filter Buttons in Header */
.game-filter {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.game-filter-btn {
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-filter-btn:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
  background: var(--color-bg-secondary);
}

.game-filter-btn.active {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  color: var(--color-text-light);
}

.nav-btn {
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
  background: var(--color-bg-secondary);
}

.cart-icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.cart-icon:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-primary);
}

#cartCount {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-accent-primary);
  color: var(--color-text-light);
  font-size: 0.7rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 120px;
  min-width: 200px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.auth-menu.show {
  display: flex;
}

.auth-menu a {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--color-text-primary);
  transition: background 0.2s ease;
}

.auth-menu a:hover {
  background: var(--color-bg-secondary);
  color: var(--color-accent-primary);
}

/* ===================================
   Games Section
   =================================== */
.games-section {
  padding: 16px 24px 0;
}

.games-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
}

.game-chip {
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-chip:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
}

.game-chip.active {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  color: var(--color-text-light);
}

/* ===================================
   Main Layout
   =================================== */
.layout {
  width: 100%;
  max-width: 1400px;
  margin: 24px auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 0 24px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 80px;
  padding: 24px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.sidebar h3 {
  margin: 0 0 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  transition: color 0.3s ease;
}

#filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Filters Empty State */
.filters-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

.filters-empty svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.filters-empty p {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.filters-empty span {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* Filter Group */
.filter-group {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.filter-group:hover {
  border-color: var(--color-border-strong);
}

.filter-group-title {
  margin: 0 0 12px 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-primary);
  transition: color 0.3s ease;
}

.filter-values {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Filter Checkbox */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.filter-checkbox:hover {
  background: var(--color-bg-tertiary);
}

.filter-checkbox input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border-strong);
  border-radius: 6px;
  background: var(--color-bg-base);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.filter-checkbox input[type="checkbox"]:hover {
  border-color: var(--color-accent-primary);
}

.filter-checkbox input[type="checkbox"]:checked {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
}

.filter-checkbox input[type="checkbox"]:checked::before {
  content: '✓';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-text-light);
  font-size: 14px;
  font-weight: 700;
}

.filter-checkbox .checkmark {
  display: none;
}

.filter-value-text {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
}

.filter-checkbox:hover .filter-value-text {
  color: var(--color-text-primary);
}

.filter-checkbox input[type="checkbox"]:checked + .checkmark + .filter-value-text {
  color: var(--color-accent-primary);
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 24px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.content h2 {
  margin: 0 0 24px;
  font-size: 1.5rem;
  font-weight: 600;
  transition: color 0.3s ease;
}

/* ===================================
   Product Grid
   =================================== */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  overflow: hidden;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--color-accent-primary);
  box-shadow: var(--shadow-hover);
}

.media {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--color-bg-tertiary);
  overflow: hidden;
  transition: background-color 0.3s ease;
}

.media img,
.media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .media img,
.card:hover .media video {
  transform: scale(1.05);
}

.content-inner {
  padding: 16px;
}

.content-inner h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.4;
  transition: color 0.3s ease;
}

.price {
  color: var(--color-accent-primary);
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 16px;
  transition: color 0.3s ease;
}

.btn {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--color-accent-primary);
  color: var(--color-text-light);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.btn.secondary:hover {
  background: var(--color-border-strong);
}

/* ===================================
   Product Detail Page
   =================================== */
.product-page-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.product-detail-container {
  width: 100%;
}

.product-detail-card {
  display: grid;
  grid-template-columns: minmax(350px, 45%) minmax(0, 1fr);
  gap: 40px;
  padding: 32px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.product-media {
  min-width: 0;
}

.product-image,
.product-video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  display: block;
  transition: all 0.3s ease;
}

.product-image {
  max-height: 500px;
  object-fit: cover;
}

.product-info h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 700;
  transition: color 0.3s ease;
}

.product-info .price {
  font-size: 1.75rem;
  color: var(--color-accent-primary);
  font-weight: 700;
  margin: 16px 0;
  transition: color 0.3s ease;
}

.product-description,
.attributes {
  margin: 24px 0;
}

.product-description h3,
.attributes h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.product-description p {
  color: var(--color-text-secondary);
  line-height: 1.8;
  transition: color 0.3s ease;
}

.attributes ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.attributes li {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--color-bg-secondary);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.attributes li span {
  color: var(--color-text-muted);
  transition: color 0.3s ease;
}

.attributes li strong {
  color: var(--color-text-primary);
  font-weight: 500;
  transition: color 0.3s ease;
}

.product-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  transition: border-color 0.3s ease;
}

.product-actions .btn {
  flex: 1;
  padding: 14px 28px;
}

.product-actions .btn.secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.product-actions .btn.secondary:hover {
  background: var(--color-border-strong);
}

/* ===================================
   Cart Modal
   =================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 74, 0.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  background: var(--color-bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transition: all 0.3s ease;
}

.modal .close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-bg-secondary);
  border-radius: 999px;
  font-size: 1.5rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
}

.modal .close:hover {
  background: var(--color-error);
  color: var(--color-text-light);
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  transition: border-color 0.3s ease;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-info h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
}

.cart-item-controls button:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
}

.cart-total {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  font-size: 1.125rem;
  font-weight: 600;
  text-align: right;
  color: var(--color-text-primary);
  transition: all 0.3s ease;
}

.checkout-btn {
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  border: none;
  border-radius: 10px;
  background: var(--color-success);
  color: var(--color-text-light);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkout-btn:hover {
  background: #6A9E7A;
  transform: translateY(-1px);
}

/* ===================================
   Login/Register Pages
   =================================== */
.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.login-header {
  margin-bottom: 32px;
  text-align: center;
}

.login-header h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

.login-header p {
  color: var(--color-text-muted);
  margin: 0;
  transition: color 0.3s ease;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  transition: color 0.3s ease;
}

.form-group input {
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-bg-base);
  color: var(--color-text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-group input:focus {
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(217, 170, 103, 0.15);
}

.btn-login {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 10px;
  background: var(--color-accent-primary);
  color: var(--color-text-light);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.btn-login:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  transition: color 0.3s ease;
}

.login-footer a {
  color: var(--color-accent-primary);
  font-weight: 500;
}

.back-link {
  display: block;
  margin-top: 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  transition: color 0.3s ease;
}

/* ===================================
   Cabinet (User Profile)
   =================================== */
.cabinet-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}

.cabinet-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
  transition: all 0.3s ease;
}

.cabinet-avatar {
  width: 80px;
  height: 80px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-accent-primary);
  transition: all 0.3s ease;
}

.cabinet-user-info h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  transition: color 0.3s ease;
}

.cabinet-user-info .text-muted {
  color: var(--color-text-muted);
  margin: 0 0 8px;
  transition: color 0.3s ease;
}

.badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--color-accent-soft);
  color: var(--color-accent-primary);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.cabinet-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
  transition: border-color 0.3s ease;
}

.cabinet-tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cabinet-tab:hover {
  color: var(--color-accent-primary);
}

.cabinet-tab.active {
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
}

.cabinet-tab-content {
  display: none;
}

.cabinet-tab-content.active {
  display: block;
}

.cabinet-section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.cabinet-section h2 {
  margin: 0 0 24px;
  font-size: 1.125rem;
  transition: color 0.3s ease;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

.info-value {
  color: var(--color-text-primary);
  font-size: 0.875rem;
  transition: color 0.3s ease;
}

.order-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
  transition: border-color 0.3s ease;
}

.order-id {
  font-weight: 600;
  color: var(--color-text-primary);
  transition: color 0.3s ease;
}

.order-status {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: var(--color-warning);
  color: #1a1816;
}

.status-paid,
.status-completed {
  background: var(--color-success);
  color: #1a1816;
}

.status-cancelled {
  background: var(--color-error);
  color: #1a1816;
}

.order-date {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  transition: color 0.3s ease;
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  transition: color 0.3s ease;
}

.order-total {
  text-align: right;
  font-weight: 600;
  color: var(--color-accent-primary);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  transition: all 0.3s ease;
}

/* ===================================
   Footer
   =================================== */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  transition: all 0.3s ease;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.footer-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--color-accent-primary);
}

.site-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg-card) 92%, var(--color-bg-base));
}

.site-footer__inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(220px, 1.28fr) minmax(180px, 1fr) minmax(190px, 1fr);
  gap: 28px;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.site-footer__column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.site-footer__title {
  margin: 0 0 2px;
  color: var(--color-text-primary);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
}

.site-footer__nav,
.site-footer__meta {
  display: grid;
  gap: 8px;
}

.site-footer__support {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.site-footer__label {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.site-footer__text {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.site-footer__nav a,
.site-footer__support a {
  color: var(--color-text-secondary);
  text-decoration: none;
  width: fit-content;
  transition: color 0.2s ease;
}

.site-footer__nav a:hover,
.site-footer__nav a:focus-visible,
.site-footer__support a:hover,
.site-footer__support a:focus-visible {
  color: var(--color-accent-primary);
}

@media (max-width: 980px) {
  .site-footer__inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 32px;
  }
}

@media (max-width: 560px) {
  .site-footer__inner {
    width: min(100% - 28px, 1180px);
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 28px 0;
  }

  .site-footer__nav,
  .site-footer__meta {
    gap: 7px;
  }
}

/* ===================================
   Loading & Error States
   =================================== */
.loading {
  text-align: center;
  color: var(--color-text-muted);
  padding: 48px;
  transition: color 0.3s ease;
}

.error {
  color: var(--color-error);
  transition: color 0.3s ease;
}

/* ===================================
   Accessibility
   =================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
    order: 2;
  }
  
  .content {
    order: 1;
  }
  
  .product-detail-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .game-filter {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .search-bar {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .header-actions {
    margin-left: 0;
  }

  .topbar-title {
    font-size: 1rem;
  }

  .layout {
    padding: 0 16px;
  }

  .content,
  .sidebar {
    padding: 16px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }

  .cabinet-header {
    flex-direction: column;
    text-align: center;
  }

  .cabinet-tabs {
    overflow-x: auto;
    white-space: nowrap;
  }

  .theme-toggle {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .theme-toggle-floating {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .nav-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .product-actions {
    flex-direction: column;
  }
  
  .login-container {
    padding: 24px;
  }
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ===================================
   Motion Accessibility
   =================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
