/* ---------------- 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 ---------------- */

.flashsale {
  position: relative;
}

.sort-select {
  position: absolute;
  top: 12px;
  right: 29px;

  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  cursor: pointer;
  outline: none;
}

/* ================= FLASH SALE SLIDER ================= */



/* FOR FLASH SALE.HTML*/
.flashsale-grid-main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 1rem;
  padding: 2rem;
  margin-top: 25px;
}

/* Each card becomes a slide */
.flashsale-card {
  min-width: 220px;
  max-width: 220px;
  scroll-snap-align: start;
  flex-shrink: 0;
  cursor: pointer;
}

/* ---------------- PRODUCT CARD ---------------- */
.flashsale-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  z-index: 999;
}

.flashsale-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* ---------------- IMAGE CONTAINER ---------------- */
.flashsale-image-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* PRODUCT IMAGE */
.flashsale-image-container img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

/* ---------------- BADGES ---------------- */


.flashsale-badge {
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 600;
}

.flashsale-timer {
  background-color: var(--destructive);
  border-radius: 5px;
  border: none;
  color: #fff;
  text-align: center;
  margin-left: 5px;
  margin-right: 5px;
  padding: 15px auto !important;
}

/* ---------------- BADGES & WISHLIST SWAP ---------------- */

/* Position both in the top-right corner */
.flashsale-badge.badge-live {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

/* LIVE BADGE: Visible by default */
.flashsale-badge.badge-live {
  z-index: 3;
  opacity: 1;
  background-color: var(--destructive);
  color: #fff;
}

.flashsale-badge.badge-discount {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 3;
  opacity: 1;
  background-color: var(--primary);
}



/* ---------------- PRODUCT INFO ---------------- */
.flashsale-info {
  padding: 0.4rem 0.6rem;
}



.flashsale-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- RATINGS ---------------- */
.flashsale-rating {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--primary);
}

.stars {
  display: flex;
  gap: 0.1rem;
}

.flashsale-rating .rating-text {
    font-size: 14px;
    color: #555;
}

/* ---------------- PRICES ---------------- */
.flashsale-sale_price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flashsale-sale_price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.original-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;
}






/* ---------- FLASHSALE CONTAINER ---------- */
.flashsale-container {
  overflow: hidden;       /* hide scrollbars */
  position: relative;
  width: 100%;
}

/* ---------- FLASHSALE GRID ---------- */
.flashsale-grid {
  display: flex;
  gap: 16px;
  transition: transform 0.5s ease-in-out;
  will-change: transform;
}

/* ---------- FLASHSALE CARD ---------- */
.flashsale-card {
  flex: 0 0 220px;       /* fixed width, no shrinking */
  cursor: pointer;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.flashsale-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}



/* ==============================
   Flashsale Slider
   ============================== */

.flashsale-container {
  overflow-x: auto;        /* allows horizontal scroll */
  scroll-behavior: smooth; /* smooth scroll for autoplay */
  cursor: grab;
}

.flashsale-container:active {
  cursor: grabbing;
}

/* Hide scrollbar but keep scrolling */
.flashsale-container::-webkit-scrollbar {
  display: none;
}

.flashsale-grid {
  display: flex;
  gap: 16px; /* match JS step */
}

.flashsale-card {
  flex-shrink: 0;    /* prevent shrinking */
}


 .flashsale-grid .flashsale-card {
    min-width: 180px;   /* 👈 reduce from 220px */
    flex: 0 0 180px;    /* 👈 important */
  }





@media (max-width: 768px) {
  #product-grid,
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    padding: 1rem;
  }

  .product-card {
    border-radius: 10px;
  }

  .product-image-container img {
    height: 140px;
  }

  .product-info {
    padding: 0.6rem;
  }

  .product-price {
    font-size: 0.95rem;
  }

  .discount-badge {
    font-size: 10px;
    padding: 3px 6px;
  }

}


/* ---------------- MOBILE IMPROVEMENTS ---------------- */
@media (max-width: 768px) {
 .flashsale-grid-main{
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  padding: 1rem;

 }



  .flashsale-info {
    padding: 0.4rem 0.6rem 0.6rem;
  }

  .flashsale-sale_price {
    font-size: 0.8rem;
  }

  .flashsale-card {
    border-radius: 10px;
    min-width: unset;
  }


  .flashsale-timer {
  border-radius: 5px;
  margin-left: 3px;
  margin-right: 3px;
  font-size: 14px;
}
}

@media (max-width: 768px) {

  .flashsale-grid {
    gap: 10px;
  }

  .flashsale-container {
    padding-left: 10px;
  }

  .flashsale-grid .flashsale-card {
    min-width: 160px;   /* 👈 reduce from 220px */
    flex: 0 0 160px;    /* 👈 important */
  }

  .flashsale-image-container img {
    height: 120px;
  }

  .flashsale-sale_price {
    font-size: 0.8rem;
  }
  
.original-price{
    font-size: 0.65rem;
    font-weight: 500;
}

.flashsale-title{
    font-size: 14px;
}

}

/* Skeleton Styles */
.skeleton-card {
  background: var(--muted);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  flex: 0 0 180px;
  animation: pulse 1.5s infinite;
}

.skeleton-image {
  height: 130px;
  background: hsl(210, 40%, 85%);
  border-radius: 8px 8px 0 0;
}

.skeleton-text {
  height: 14px;
  background: hsl(210, 40%, 85%);
  border-radius: 4px;
}

.skeleton-title {
  width: 80%;
  margin: 0.5rem 0;
}

.skeleton-price {
  width: 40%;
  height: 16px;
  margin-bottom: 0.5rem;
}

@keyframes pulse {
  0% { background-color: hsl(210, 40%, 85%); }
  50% { background-color: hsl(210, 40%, 90%); }
  100% { background-color: hsl(210, 40%, 85%); }
}
