:root {
  /* ===== ЕДИНЫЙ ЦВЕТОВОЙ СТИЛЬ — СВЕТЛАЯ МОЛОЧНАЯ ТЕМА ===== */
  --accent: #4ecdc4;
  --accent-hover: #3aa8a0;
  --accent-gradient: linear-gradient(135deg, #4ecdc4, #66d9cc);

  /* Фоны */
  --primary-bg: #faf9f6;
  --card-bg: rgba(250, 248, 242, 0.85);
  --sidebar-bg: #fdfcf9;

  /* Текст */
  --text-primary: #2d2d2d;
  --text-secondary: #5a5a5a;
  --text-muted: #999;

  /* Границы и тени */
  --border: rgba(0, 0, 0, 0.06);
  --hover-bg: rgba(78, 205, 196, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 12px 40px rgba(78, 205, 196, 0.12);

  /* Радиусы */
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-lg: 20px;

  /* Анимации */
  --transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-slow: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* === Страница игр/приложений — светлая молочная тема === */
.games-page,
.apps-page {
  padding: 20px;
  max-width: 100%;
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === HEADER === */
.games-header,
.apps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.games-header h1,
.apps-header h1 {
  font-size: 2rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  color: white;
  background: var(--accent-gradient);
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.15);
}

.back-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(78, 205, 196, 0.25);
}

/* === SEARCH BOX === */
.search-box {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.search-box input {
  width: 90%;
  max-width: 500px;
  padding: 12px 18px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.15);
  background: white;
}

/* === FILTER PANEL === */
.filters {
  display: flex !important;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: flex-start;
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.filter-toggle {
  display: none;
}

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

.filters input,
.filters select {
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition);
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.15);
  background: white;
}

.filters button {
  background: var(--accent-gradient);
  color: white;
  padding: 10px 18px;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.filters button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.25);
}

/* === PRODUCTS GRID === */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  width: 100%;
  justify-items: center;
  margin: 0 auto;
}

/* === PRODUCT CARD === */
.product-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 12px;
  display: flex;
  gap: 10px;
  transition: var(--transition);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-direction: column;
  align-items: center;
}

.product-card:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: var(--shadow-hover);
  border-color: rgba(78, 205, 196, 0.3);
}

/* === PRODUCT IMAGE === */
.product-image {
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.08);
}

/* === PRODUCT CONTENT === */
.product-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.product-content h3 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-content .price {
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}

.product-content .desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-height: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.product-content .seller,
.product-content .reviews {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === STAR RATINGS === */
.product-content .reviews i {
  color: #fcd34d;
  margin-right: 2px;
}

/* === BUTTONS === */
.buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.buttons .btn-cart,
.buttons .btn-view {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.buttons .btn-cart {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 10px rgba(78, 205, 196, 0.15);
}

.buttons .btn-cart:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 14px rgba(78, 205, 196, 0.25);
}

.buttons .btn-view {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.buttons .btn-view:hover {
  background: rgba(240, 240, 240, 1);
  border-color: var(--accent);
  color: var(--accent);
}

/* === LINK === */
.product-card .product-link {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

/* === LOADER AND END MESSAGE === */
#loader,
#endMessage {
  text-align: center;
  margin: 20px 0;
  font-weight: 500;
  display: none;
  color: var(--text-muted);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .product-image {
    height: 140px;
  }
}

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .product-image {
    height: 120px;
  }
  .search-box input {
    width: 95%;
  }
  .buttons {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
  .product-content .desc {
    max-height: 60px;
  }
}

/* === BREADCRUMBS === */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

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

.breadcrumb-separator {
  color: var(--text-muted);
}

/* === МОДАЛКА ПОДКАТЕГОРИЙ === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: white;
  padding: 20px 25px;
  border-radius: var(--border-radius);
  width: 400px;
  max-width: 90%;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transform: translateY(-30px);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.show .modal-content {
  transform: translateY(0);
}

.modal-content h3 {
  color: var(--accent);
  margin-bottom: 15px;
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-content .close {
  float: right;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.3s;
}

.modal-content .close:hover {
  color: var(--accent);
}

#subcategories-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.subcategory-item {
  margin: 10px 0;
}

.subcategory-item a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s;
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
}

.subcategory-item a:hover {
  color: var(--accent);
  background: var(--hover-bg);
}
