/* Define variable curve if it doesn't exist in style.css */
:root {
  --curve: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Remove bullet points from all lists */
ul, ol {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* PRODUCT CATEGORIES SECTION */
.product-categories {
  padding: 10rem 7% 8rem;
  background-color: #f9fafb;
  position: relative;
  overflow: hidden;
}

.product-categories::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../img/pattern.svg');
  opacity: 0.03;
  z-index: 0;
}

.product-categories h2 {
  font-size: 3.6rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text-dark);
  font-family: var(--heading-font);
  position: relative;
}

.product-categories h2 span {
  color: var(--primary);
  font-weight: 700;
}

/* Improved shiny text effect for subtitle */
.product-categories .subtitle {
  text-align: center;
  font-size: 1.7rem;
  color: #666;
  margin-bottom: 6rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  /* Add shiny text effect */
  background: linear-gradient(
    to right,
    #666 20%,
    #206117 40%,
    #206117 60%,
    #666 80%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine-subtitle 4s linear infinite;
}

@keyframes shine-subtitle {
  to {
    background-position: 200% center;
  }
}

/* Modified grid layout for 6 cards (without Heritage) - 1-2-2-1 pattern */
.category-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2.5rem;
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
}

/* First card (Spices) takes full width on first row */
.category-grid .category-card:nth-child(1) {
  grid-column: span 12;
}

/* Seeds & Tubers cards take 6 columns each on second row */
.category-grid .category-card:nth-child(2),
.category-grid .category-card:nth-child(3) {
  grid-column: span 6;
}

/* Vegetables & Fruits take 6 columns each on third row */
.category-grid .category-card:nth-child(4),
.category-grid .category-card:nth-child(5) {
  grid-column: span 6;
}

/* Flowers card takes full width on fourth row - matching Spices */
.category-grid .category-card:nth-child(6) {
  grid-column: span 12;
}

/* Add collage image effect for Vegetables and Fruits cards */
.category-grid .category-card:nth-child(4) .category-image,
.category-grid .category-card:nth-child(5) .category-image {
  position: relative;
  height: 240px;
  overflow: hidden;
  display: flex;
}

/* Create the collage layout with two images side by side */
.category-image.collage {
  display: flex !important;
  overflow: hidden;
}

.category-image.collage img {
  width: 50% !important;
  height: 100% !important;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.category-image.collage img:first-child {
  border-right: 2px solid rgba(255, 255, 255, 0.5);
}

/* Make sure overlay works correctly on collage */
.category-card:hover .category-image.collage img {
  transform: scale(1.05);
}

/* Ensure the Flowers card spans full width just like Spices */
.category-grid .category-card:nth-child(6) {
  grid-column: span 12 !important;
}

/* Make the Flowers image taller like Spices for visual balance */
.category-grid .category-card:nth-child(1) .category-image,
.category-grid .category-card:nth-child(6) .category-image {
  height: 320px !important; /* Taller images for the full-width cards */
}

/* Make the Seeds category-info align at the bottom like Tubers */
.category-grid .category-card:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.category-grid .category-card:nth-child(2) .category-products {
  margin-bottom: auto; /* Pushes the info section down */
}

/* Make single item list in Seeds take more vertical space */
.category-grid .category-card:nth-child(2) .category-products li {
  padding-top: 2rem;
  padding-bottom: 2rem; /* Add more padding to take up space */
}

/* Make sure all lists in category grid have no bullets */
.category-grid ul,
.category-grid li {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* Heritage card takes full width on first row (1) */
.heritage-card {
  grid-column: span 12;
  border-radius: 20px;
}

/* Spices & Seeds cards take 6 columns each on second row (2) */
.category-grid .category-card:nth-child(2),
.category-grid .category-card:nth-child(3) {
  grid-column: span 6;
}

/* Tubers & Vegetables take 6 columns each on third row (2) */
.category-grid .category-card:nth-child(4),
.category-grid .category-card:nth-child(5) {
  grid-column: span 6;
}

/* Fruits & Flowers take 6 columns each on fourth row (2) */
.category-grid .category-card:nth-child(6),
.category-grid .category-card:nth-child(7) {
  grid-column: span 6;
}

.category-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.4s var(--curve); /* Use the variable now that it's defined */
  background-color: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.category-card:hover {
  transform: translateY(-10px) scale(1.01);
  box-shadow: 0 20px 40px rgba(32, 97, 23, 0.12);
}

/* Improved Heritage Card Layout */
.heritage-card .category-image {
  height: 320px;
}

.category-image {
  position: relative;
  height: 240px; /* Increased height for better display */
  overflow: hidden;
}

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

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

.category-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
  display: flex;
  align-items: flex-end;
  padding: 2.5rem;
  transition: background 0.3s ease;
}

.category-card:hover .category-overlay {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.7) 100%);
}

.category-name {
  color: white;
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--heading-font);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.category-card:hover .category-name {
  transform: translateY(-5px);
}

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

/* Remove bullets from any lists within content */
.category-content ul,
.category-content ol,
.category-content li {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* Category link styles */

.category-products li {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-top: 1.5rem;
}

.category-products span {
    padding-left: 1rem;
}

.category-products i {
    padding-top: 200px;
}

.category-info span {
    padding-left: 1rem;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .category-grid {
    grid-template-columns: repeat(12, 1fr);
  }
  
  /* First and last cards full width */
  .category-grid .category-card:nth-child(1),
  .category-grid .category-card:nth-child(6) {
    grid-column: span 12;
  }
  
  /* Middle cards 2 per row */
  .category-grid .category-card:nth-child(2),
  .category-grid .category-card:nth-child(3),
  .category-grid .category-card:nth-child(4),
  .category-grid .category-card:nth-child(5) {
    grid-column: span 6;
  }
}

@media (max-width: 992px) {
  .category-grid {
    grid-template-columns: repeat(12, 1fr); /* Ubah ke 12 kolom untuk konsistensi */
  }
  
  .heritage-card {
    grid-column: span 12; /* Tetap full width */
  }
  
  .category-grid .category-card:nth-child(2),
  .category-grid .category-card:nth-child(3),
  .category-grid .category-card:nth-child(4),
  .category-grid .category-card:nth-child(5),
  .category-grid .category-card:nth-child(6),
  .category-grid .category-card:nth-child(7) {
    grid-column: span 6; /* Semua card regular menggunakan 6 kolom */
  }
}

@media (max-width: 768px) {
  .product-categories {
    padding: 7rem 5% 6rem;
  }
  
  .category-grid {
    gap: 2rem;
  }
  
  .heritage-card {
    grid-column: span 12;
  }
  
  /* On tablets, still keep 2 cards per row */
  .category-grid .category-card:nth-child(2),
  .category-grid .category-card:nth-child(3),
  .category-grid .category-card:nth-child(4),
  .category-grid .category-card:nth-child(5),
  .category-grid .category-card:nth-child(6),
  .category-grid .category-card:nth-child(7) {
    grid-column: span 6;
  }
  
  .category-image {
    height: 200px; /* Slightly smaller on tablets */
  }
}

@media (max-width: 576px) {
  .product-categories h2 {
    font-size: 2.8rem;
  }
  
  .product-categories .subtitle {
    font-size: 1.5rem;
    margin-bottom: 4rem;
  }
  
  .category-grid {
    grid-template-columns: 1fr;
  }
  
  /* On mobile, 1 card per row */
  .heritage-card,
  .category-grid .category-card:nth-child(2),
  .category-grid .category-card:nth-child(3),
  .category-grid .category-card:nth-child(4),
  .category-grid .category-card:nth-child(5),
  .category-grid .category-card:nth-child(6),
  .category-grid .category-card:nth-child(7) {
    grid-column: span 12;
  }
  
  .category-image {
    height: 200px; /* Good height for mobile */
  }
}

/* Ganti style category-link menjadi category-info */
.category-info {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-radius: 8px;
  background-color: rgba(32, 97, 23, 0.08);
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
}

.category-info .export-info {
  display: flex;
  align-items: center;
}

.category-info .export-info i {
  margin-right: 1.5rem;
  color: var(--primary);
  font-size: 1.8rem;
}

.certification-badges {
  display: flex;
  gap: 0.8rem;
}

.certification-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  background-color: rgba(32, 97, 23, 0.15);
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 500;
}

/* Media queries untuk responsif */
@media (max-width: 576px) {
  .category-info {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
  }
  
  .certification-badges {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Pastikan CSS ini sudah diterapkan dengan benar untuk menyembunyikan category-link */
.category-link {
  display: none; /* Menyembunyikan semua elemen dengan class category-link */
}

/* Improved mobile display for category info */
@media (max-width: 576px) {
  /* Keep heritage card info as is */
  .heritage-card .category-info {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
  }
  
  /* Fix the other cards (Spices, Seeds, etc.) info layout */
  .category-grid .category-card:not(.heritage-card) .category-info {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    gap: 0.8rem;
    background-color: rgba(32, 97, 23, 0.08);
    margin-top: 2rem;
  }
  
  /* Fix the text size for "Available for Export" */
  .category-grid .category-card:not(.heritage-card) .export-info span {
    font-size: 1.1rem; /* Corrected from 1px to proper size */
    white-space: nowrap;
    letter-spacing: -0.2px;
  }
  
  /* Make icon proper size */
  .category-grid .category-card:not(.heritage-card) .export-info i {
    font-size: 1.3rem;
    margin-right: 0.6rem;
    color: var(--primary);
  }
  
  /* Adjust certification badges to be more visible */
  .category-grid .category-card:not(.heritage-card) .certification-badges {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
  }
  
  .category-grid .category-card:not(.heritage-card) .certification-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    letter-spacing: -0.2px;
    background-color: rgba(32, 97, 23, 0.15);
    border-radius: 4px;
    color: var(--primary);
  }
}

/* Extra small devices - further optimization */
@media (max-width: 360px) {
  .category-grid .category-card:not(.heritage-card) .category-info {
    padding: 0.7rem 1rem;
  }
  
  .category-grid .category-card:not(.heritage-card) .export-info span {
    font-size: 1rem; /* Still readable but smaller */
  }
  
  .category-grid .category-card:not(.heritage-card) .export-info i {
    font-size: 1.2rem;
    margin-right: 0.5rem;
  }
  
  .category-grid .category-card:not(.heritage-card) .certification-badge {
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
  }
}