/* Section Container */
.md-color-section {
  margin-bottom: 50px;
  width: 100%;
}

.md-color-section-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 25px;
  color: #333;
  text-align: center;
}

/* Unified Grid for Both Categories and Colors */
.md-color-categories,
.md-color-catalog {
  display: grid;
  gap: 20px;
  width: 100%;
}

/* Mobile: 2 items per row */
@media (max-width: 575px) {
  .md-color-categories,
  .md-color-catalog {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

/* Tablet: 4 items per row */
@media (min-width: 576px) and (max-width: 991px) {
  .md-color-categories,
  .md-color-catalog {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }
}

/* Desktop: 8-9 items per row */
@media (min-width: 992px) {
  .md-color-categories,
  .md-color-catalog {
    grid-template-columns: repeat(8, 1fr);
    gap: 20px;
  }
}

/* Large Desktop: 9 items per row */
@media (min-width: 1400px) {
  .md-color-categories,
  .md-color-catalog {
    grid-template-columns: repeat(9, 1fr);
    gap: 20px;
  }
}

/* Unified Item Styling - Same for Categories and Colors */
.md-category-item,
.md-color-item {
  position: relative;
  width: 100%;
}

.md-category-link,
.md-color-link {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
}

/* Unified Cover/Thumb Styling - 16:9 Aspect Ratio */
.md-category-cover,
.md-color-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-bottom: 8px;
}

.md-category-cover-default {
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover Effects - Same for Both */
.md-category-item:hover .md-category-cover,
.md-color-item:hover .md-color-thumb {
  border-color: #999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Unified Name Styling */
.md-category-name,
.md-color-name {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  line-height: 1.3;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 34px;
}

/* Active/Selected State */
.md-category-item.active .md-category-cover,
.md-color-item.active .md-color-thumb {
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2);
}

/* Loading State */
.md-category-cover.loading,
.md-color-thumb.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

