.home-products, .product-archive {
    display: flex;
    flex-direction: column;
    padding: 20px 0px;
    gap: 20px;
    margin-top: 20px;
}



.products-grid {
  /* margin-top: 20px; */
  display: grid;
  grid-template-columns: repeat(4, 1fr); 
  gap: 20px;
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* margin-bottom: 20px; */
  padding: 10px 0px;
  flex-wrap: wrap; 
  gap: 10px;    
  border-bottom: 1px solid var(--color-border);  
}


.product-card {
  position: relative;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.product-card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-content {
  padding: 15px;
}

.product-title {
  font: var(--sub-heading);
  color: var(--color-text-dark);
  margin: 0 0 8px;
}

.product-price, .single-product-condition-inner {
  font: var(--body-large);
  font-weight: 600;
  color: var(--color-primary);
  margin: 0 0 4px;
}

.product-condition {
  position: absolute;
  top: 5px;
  left: 5px;
  display: inline-block;
  padding: 2px 8px;
  font: var(--body-small);
  background: var(--color-bg);
  color: var(--color-text-medium);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  box-shadow: 0.5px 0.5px 5px rgba(0, 0, 0, 0.829);
  z-index: 1;
}

.favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 50%;

  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;

  font-size: 18px;
  color: #e63946;

  transition: all 0.3s ease;
  z-index: 10;
}

/* Hover only if NOT active */
.favorite-btn:not(.active):hover {
  background-color: #e63946;
  color: #fff;
  transform: scale(1.05);
}

.favorite-btn .fa-heart {
  transition: transform 0.25s ease, color 0.25s ease;
}

.favorite-btn:not(.active):hover .fa-heart {
  transform: scale(1.2);
}

/* Active state always consistent */
.favorite-btn.active {
  background-color: #e63946;
  border-color: #e63946;
  color: #fff;
}

.favorite-btn.active .fa-heart {
  color: #fff;
}

/* ------------------------------
   Single Product Page
------------------------------- */
.single-product {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Product Main Wrapper */
.product-main {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

/* Left Gallery */
.product-gallery {
    flex: 1;
    min-width: 300px;
}

.product-main-image {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.product-main-image img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.product-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}


.thumb-link {
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    display: inline-block;
    cursor: pointer;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.thumb-link img {
    display: block;
    width: 70px;
    height: 70px;
    object-fit: cover;
}

.thumb-link.active,
.thumb-link:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.product-info {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 20px;
    list-style: none;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.tabs-nav li {
    padding: 10px 15px;
    cursor: pointer;
    font: var(--body-regular);
    color: var(--color-text-medium);
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tabs-nav li.active {
    color: var(--color-text-dark);
    border-color: var(--color-primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 10px 0;
    font: var(--body-regular);
    color: var(--color-text-dark);
}

.tab-content.active {
    display: block;
}

/* Related Products Grid */
.related-products {
    margin-top: 40px;
}

.commentlist {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0px;
}
.commentlist > li, #respond {
    padding: 20px;
    box-shadow: 1px 1px 10px rgba(0,0,0,0.2);
    border-radius: 8px;
    list-style: none;
}
.commentlist li {
    display: flex; 
    flex-direction: column;
    gap: 20px;
}


.product-author-box {
    display: flex;
    gap: 20px;
    justify-content: start;
    align-items: center;
}
.product-author-box .author-avatar img{ 
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.product-author-box .author-name {
  font-size: var(--body-regular);
}

@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-card-image {
    height: 180px;
  }
}

/* Mobile (max-width: 768px) → 1 column */
@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-header {
    flex-direction: column;
    align-items: center; 
  }

  .view-all-btn {
    text-align: center;
    width: 100%;
    margin-top: 5px;
  }

  .product-card-image {
    height: 160px;
  }

  .product-card-content {
    padding: 12px;
  }

  .product-title {
    font-size: 20px;
  }

  .product-price, .single-product-condition-inner {
    font-size: 16px;
  }

  .product-condition {
    font-size: 12px;
  }

  .product-main {
      flex-direction: column;
  }

  .product-thumbnails img {
      width: 60px;
      height: 60px;
  }
}

/* Very small devices (max-width: 480px) */
@media (max-width: 480px) {
  .home-products {
    padding: 15px 0;
    gap: 15px;
  }

  .product-card {
    border-radius: 8px;
  }

  .product-card-image {
    height: 180px;
  }
  .thumb-link img {
      width: 50px;
      height: 50px;
  }

  .product-info .btn-yellow {
      width: 100%;
      justify-content: center;
  }
  .product-main-image img {
    height: 300px;
  }
}
