/**
 * Categories Grid Module - Front Office Styles
 */

.categories-grid-section {
  padding: 3rem 0;
  /* background-color: #f8f9fa; */
}

.categories-grid-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 600;
  color: #232323;
}

.categories-grid {
  margin: 0 -0.5rem;
  display: flex;
  flex-wrap: wrap;
}

.categories-grid-item {
  padding: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex: 1 1 calc(25% - 1rem);
  min-width: 0;
}

.category-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.category-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: linear-gradient(315deg, transparent 32px, #ffca9b 32px, #ffca9b 42px, transparent 42px),
              linear-gradient(315deg, transparent 10px, #ffca9b 10px, #ffca9b 18px, transparent 18px);
  border-bottom-right-radius: 8px;
  pointer-events: none;
  z-index: 2;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.category-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
  width: 100%;
}

.category-link:hover {
  text-decoration: none;
  color: inherit;
}

.category-image {
  position: relative;
  overflow: hidden;
  background-color: #f6f6f6;
  aspect-ratio: 16/9;
}

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

.category-card:hover .category-image img {
  transform: scale(1.05);
}

.category-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.category-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #232323;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
  min-height: 2.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-description {
  font-size: 0.875rem;
  color: #7a7a7a;
  margin: 0 0 1rem 0;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.products-count {
  font-size: 0.8rem;
  color: #db7500;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 767.98px) {
  .categories-grid-section {
    padding: 2rem 0;
  }
  
  .categories-grid-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .categories-grid-item {
    margin-bottom: 0.75rem;
    flex: 1 1 calc(33.333% - 1rem);
  }
  
  .category-content {
    padding: 1rem;
  }
  
  .category-name {
    font-size: 1rem;
    min-height: 2.4rem;
  }
  
  .category-description {
    font-size: 0.8rem;
  }
}

@media (max-width: 575.98px) {
  .categories-grid {
    margin: 0 -0.25rem;
  }
  
  .categories-grid-item {
    padding: 0.25rem;
    flex: 1 1 calc(50% - 0.5rem);
  }
  
  .category-content {
    padding: 0.75rem;
  }
  
  .category-name {
    font-size: 0.9rem;
    min-height: 2.2rem;
  }
  
  .products-count {
    font-size: 0.75rem;
  }
}

/* Animation for loading */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.categories-grid-item {
  animation: fadeInUp 0.6s ease forwards;
}

.categories-grid-item:nth-child(1) { animation-delay: 0.1s; }
.categories-grid-item:nth-child(2) { animation-delay: 0.2s; }
.categories-grid-item:nth-child(3) { animation-delay: 0.3s; }
.categories-grid-item:nth-child(4) { animation-delay: 0.4s; }
.categories-grid-item:nth-child(5) { animation-delay: 0.5s; }
.categories-grid-item:nth-child(6) { animation-delay: 0.6s; }
.categories-grid-item:nth-child(7) { animation-delay: 0.7s; }
.categories-grid-item:nth-child(8) { animation-delay: 0.8s; }

/* Loading state */
.category-image {
  position: relative;
}

.category-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.category-image img {
  position: relative;
  z-index: 1;
}

/* Focus states for accessibility */
.category-link:focus {
  outline: 2px solid #24b9d7;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .category-card {
    border: 2px solid #000;
  }
  
  .category-name {
    color: #000;
  }
  
  .products-count {
    color: #000;
    font-weight: bold;
  }
}

/* Fallback for browsers that don't support webkit line clamp */
@supports not (-webkit-line-clamp: 2) {
  .category-name {
    max-height: 2.6rem;
    overflow: hidden;
    position: relative;
  }
  
  .category-name::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    background: #fff;
    padding-left: 0.25rem;
  }
  
  .category-description {
    max-height: 3.5rem;
    overflow: hidden;
    position: relative;
  }
  
  .category-description::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    background: #fff;
    padding-left: 0.25rem;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .category-card,
  .category-image img,
  .categories-grid-item {
    transition: none;
    animation: none;
  }
} 
