/* === КАТЕГОРИИ === */
.categories {
  padding: 1.5rem 0.8rem;
  background: #ffffff;
  border-radius: 1.5rem;
  margin: 1.2rem 0.8rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.categories-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1.4rem;
  position: relative;
}

.categories-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: #f97316;
  border-radius: 2px;
}

/* === Основные категории === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  padding: 0 0.4rem;
}

@media (min-width: 480px) {
  .category-grid {
    gap: 1rem;
    padding: 0 0.5rem;
  }
}

@media (min-width: 640px) {
  .category-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 1.2rem;
  }
}

.category-card {
  background: #fff;
  border-radius: 1.1rem;
  padding: 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border-color: #fed7aa;
}

.category-card.active {
  background: #fff7ed;
  border-color: #fb923c;
  box-shadow: 0 6px 18px rgba(251, 146, 60, 0.25);
}

.category-card.active .category-name {
  color: #c2410c;
  font-weight: 600;
}

.category-icon-wrapper {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.5rem;
  background: #fef3c7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

@media (min-width: 480px) {
  .category-icon-wrapper {
    width: 56px;
    height: 56px;
  }
}

@media (min-width: 640px) {
  .category-icon-wrapper {
    width: 60px;
    height: 60px;
  }
}

.category-card.active .category-icon-wrapper {
  background: #fde68a;
  transform: scale(1.08);
}

.category-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.category-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: #4b5563;
  word-break: break-word;
}

/* === ПОДКАТЕГОРИИ: ПОЛНАЯ СЕТКА === */
.subcategory-grid-wrapper {
  margin-top: 1.6rem;
  opacity: 0;
  transform: translateY(-12px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.subcategory-grid-wrapper.show {
  opacity: 1;
  transform: translateY(0);
}

.subcategory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  padding: 0 0.4rem;
}

@media (min-width: 480px) {
  .subcategory-grid {
    gap: 0.8rem;
    padding: 0 0.5rem;
  }
}

@media (min-width: 640px) {
  .subcategory-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .subcategory-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 1.1rem;
  }
}

.subcategory-card {
  background: white;
  border-radius: 0.9rem;
  padding: 0.8rem 0.6rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1.6px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
}

.subcategory-card:hover {
  border-color: #fdba74;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.subcategory-card.active {
  background: #fff4e6;
  color: #c2410c;
  border-color: #fb923c;
  font-weight: 600;
  box-shadow: 0 5px 14px rgba(251, 146, 60, 0.28);
}

.subcategory-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: grayscale(100%) opacity(0.7);
  transition: filter 0.3s ease;
}

@media (min-width: 480px) {
  .subcategory-icon {
    width: 35px;
    height: 35px;
  }
}

@media (min-width: 640px) {
  .subcategory-icon {
    width: 38px;
    height: 38px;
  }
}

.subcategory-card:hover .subcategory-icon,
.subcategory-card.active .subcategory-icon {
  filter: none;
}

.subcategory-name {
  font-size: 0.78rem;
  line-height: 1.2;
  word-break: break-word;
}

/* Дополнительные фиксы для мобильных */
@media (max-width: 480px) {
  .categories {
    padding: 1.2rem 0.6rem;
    margin: 1rem 0.6rem;
  }
  .categories-title {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
  }
  .category-grid {
    gap: 0.7rem;
  }
  .category-card {
    padding: 0.8rem;
  }
  .category-name {
    font-size: 0.72rem;
  }
  .subcategory-grid {
    gap: 0.6rem;
  }
  .subcategory-card {
    padding: 0.7rem 0.5rem;
  }
  .subcategory-name {
    font-size: 0.75rem;
  }
}