/* ---------------- RESET ---------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--background);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------------- THEME VARIABLES ---------------- */
:root {
  --primary: hsl(16, 90%, 55%);
  --primary-dark: hsl(16, 90%, 45%);
  --secondary: hsl(174, 62%, 47%);
  --background: hsl(0, 0%, 98%);
  --foreground: hsl(222, 47%, 11%);
  --card: hsl(0, 0%, 100%);
  --border: hsl(214, 32%, 91%);
  --muted: hsl(210, 40%, 96%);
  --muted-foreground: hsl(215, 16%, 47%);
  --success: hsl(142, 71%, 45%);
  --warning: hsl(38, 92%, 50%);
  --destructive: hsl(0, 84%, 60%);
}



/* ---------------- SORTING OPTIONS ---------------- */

.products-grid-section {
    position: relative;
    display: flex;
    justify-content: flex-end; /* Keeps the dropdown on the right */
    padding: 1rem 2rem 0.5rem 2rem;
}



.sort-select {
    position: relative; 
    
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card);
    cursor: pointer;
    outline: none;
    font-size: 0.9rem; /* Slightly smaller for better mobile fit */
    color: var(--foreground);
    z-index: 10;
}






/* ---------------- PRODUCT GRID ---------------- */
#product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  padding: 1rem 2rem 2rem;
  margin-top: 0;
}



/* ---------------- PRODUCT CARD ---------------- */
.product-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* ---------------- IMAGE CONTAINER ---------------- */

/* PRODUCT IMAGE */
.product-image-container img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

/* ---------------- BADGES ---------------- */
.product-badges {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 2;
}

.product-badge {
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.discount-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;

  font-size: 13px;
  font-weight: 600;

  color: var(--primary);
  background-color: hsl(16, 90%, 95%); /* lighter primary */

  border-radius: 6px;
  line-height: 1;
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
}

/* ---------------- WISHLIST ---------------- */
.wishlist-btn {
  position: absolute;
  top: 5px;
  right:5px;
  width: 2rem;
  height: 2rem;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.2s ease;
}

.wishlist-btn:hover {
  transform: scale(1.1);
}

.wishlist-btn svg {
  width: 16px;
  height: 16px;
}

.wishlist-btn.active svg {
  fill: var(--destructive);
  stroke: var(--destructive);
}

/* ---------------- ADD TO CART (OVERLAY) ---------------- */
.add-to-cart-btn {
  position: absolute;
  bottom: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 1.2rem);

  background: var(--primary);
  color: #fff;
  padding: 10px;
  border-radius: 8px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  font-weight: 600;
  border: none;
  cursor: pointer;

  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2;
}

.add-to-cart-btn:hover {
  background: var(--primary-dark);
}

/* SHOW BUTTON ON HOVER */
.product-card:hover .add-to-cart-btn {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ICON */
.add-to-cart-btn .icon {
  width: 18px;
  height: 18px;
}

/* ---------------- PRODUCT INFO ---------------- */
.product-info {
  padding: 0.5rem;
}

.product-card-name {
  font-size: 1rem;
  font-weight: bold;
  color: var(--foreground);
  
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Show exactly 2 lines */
  -webkit-box-orient: vertical;  
  overflow: hidden;
  text-overflow: ellipsis;
  
  line-height: 1.3em;
  height: 2.6em; 
  margin-bottom: 4px;
}

/* ==============================
   Rating Stars
   ============================== */


.product-rating {
    color: var(--primary);          /* Gold stars */
}

.product-rating .rating-text {
    font-size: 14px;
    color: #555;
}

.new-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  background: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
}


/* ---------------- PRICES ---------------- */
.product-prices {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.old-price {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  text-decoration: line-through;
}


.delivery-btn {
    background-color: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s;
}


.products-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.7rem;
  padding: 1rem 2rem 2rem;
}


/* ---------------- MOBILE IMPROVEMENTS ---------------- */


@media (max-width: 768px) {
  #product-grid,
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    padding: 0.5rem 1rem 0 1rem;
  }
  

  .product-card {
    border-radius: 10px;
  }

  .product-image-container img {
    height: 120px;
  }

  .product-info {
    padding: 0.4rem;
  }

  .product-price {
    font-size: 0.8rem;
  }

  .discount-badge {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  .old-price{
      font-size: 0.65rem;
  }
  
  .product-card-name{
      font-size: 0.95rem;
      line-height: 1.2em;
      height: 2.4em;
  }
  
 

}

/* Skeleton Loader Styles */
.skeleton-card {
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    animation: shimmer 1.5s infinite linear;
}

.skeleton-card .skeleton-image {
    width: 100%;
    height: 180px;
    background: #e0e0e0;
}

.skeleton-card .skeleton-text {
    height: 16px;
    margin: 8px 12px;
    background: #e0e0e0;
    border-radius: 4px;
}

.skeleton-card .skeleton-text.short {
    width: 40%;
}

.skeleton-card .skeleton-text.long {
    width: 80%;
}

.skeleton-card .skeleton-text.price {
    width: 50%;
    height: 20px;
    margin-top: 4px;
}

/* Shimmer animation */
@keyframes shimmer {
    0% { background-position: -300px 0; }
    100% { background-position: 300px 0; }
}

.skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400px 100%;
}
