/* ================= POPULAR SECTION (NEW DESIGN) ================= */

.popular-section {
  padding: 50px 0px;
  background: #fff;
}

.popular-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}

.popular-header h2 {
  font-size: clamp(26px, 2.2vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: #0f172a;
}

/* ================= TABS (Screenshot style) ================= */

.popular-tabs {
  display: flex;
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.popular-tabs li {
  cursor: pointer;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  transition: 0.25s ease;
  position: relative;
}

.popular-tabs li:hover {
  color: #3bb77e;
}

.popular-tabs li.active {
  color: #3bb77e;
}

.popular-tabs li.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 100%;
  height: 2px;
  border-radius: 20px;
  background: #3bb77e;
}

/* ================= GRID ================= */

.popular-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 22px;
}

/* ================= CARD (Screenshot premium style) ================= */

.popular-card {
  background: #ffffff;
  border-radius: 22px;
  padding: 16px;
  position: relative;
  border: 1px solid #eef2f7;
  transition: 0.35s ease;
  overflow: hidden;
}

.popular-card:hover {
  transform: translateY(-6px);
  border-color: rgba(59, 183, 126, 0.35);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
}

/* subtle top shine like modern ecommerce */
.popular-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 20% 0%,
    rgba(59, 183, 126, 0.10),
    transparent 55%
  );
  opacity: 0;
  transition: 0.35s ease;
  pointer-events: none;
}

.popular-card:hover::before {
  opacity: 1;
}

/* ================= BADGE ================= */

.popular-card .badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  color: #fff;
  z-index: 2;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
}

.badge.hot {
  background: linear-gradient(135deg, #ff2f6d, #ff6b6b);
}
.badge.sale {
  background: linear-gradient(135deg, #2dd4bf, #3bb77e);
}
.badge.new {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}
.badge.discount {
  background: linear-gradient(135deg, #fb923c, #f97316);
}

/* ================= IMAGE BOX (Colored soft bg like screenshot) ================= */

.popular-img {
  position: relative;
  height: 200px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  overflow: hidden;
}

.popular-card:nth-child(5n + 1) .popular-img { background: #fff1ef; }
.popular-card:nth-child(5n + 2) .popular-img { background: #f0ffe7; }
.popular-card:nth-child(5n + 3) .popular-img { background: #ecfff0; }
.popular-card:nth-child(5n + 4) .popular-img { background: #fff2ff; }
.popular-card:nth-child(5n + 5) .popular-img { background: #fff0e8; }

.popular-img img {
  max-width: 78%;
  max-height: 78%;
  object-fit: contain;
  transition: 0.35s ease;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.10));
}

.popular-card:hover .popular-img img {
  transform: scale(1.06);
}

/* ================= HOVER ACTIONS (Better position like ecommerce) ================= */

.popular-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateX(10px);
  transition: 0.25s ease;
  z-index: 2;
}

.popular-card:hover .popular-actions {
  opacity: 1;
  transform: translateX(0);
}

.popular-actions button {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.08);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.25s ease;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.10);
}

.popular-actions button i {
  font-size: 18px;
  color: #0f172a;
}

.popular-actions button:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 183, 126, 0.4);
}

.popular-actions button:hover i {
  color: #3bb77e;
}

/* ================= BODY ================= */

.popular-body {
  padding-top: 14px;
}

.popular-cat {
  font-size: 13px;
  color: #94a3b8;
  display: block;
  margin-bottom: 4px;
}

.popular-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 10px;
  color: #0f172a;
  min-height: 44px; /* keeps equal height like screenshot */
}

.popular-title a {
  color: inherit;
  text-decoration: none;
  transition: 0.25s ease;
}

.popular-title a:hover {
  color: #3bb77e;
}

.popular-rating {
  font-size: 14px;
  font-weight: 700;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popular-rating span {
  font-weight: 600;
  color: #94a3b8;
}

.popular-vendor {
  font-size: 13px;
  color: #64748b;
  margin: 8px 0 14px;
}

.popular-vendor b,
.popular-vendor a {
  color: #3bb77e;
}

/* ================= FOOTER ================= */

.popular-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.popular-price strong {
  color: #16a34a;
  font-size: 18px;
  font-weight: 900;
}

.popular-price del {
  color: #9ca3af;
  font-size: 13px;
  margin-left: 8px;
  font-weight: 700;
}

.add-btn {
  background: #eaf7ef;
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.12);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.25s ease;
  min-width: 108px;
  justify-content: center;
}

.add-btn i {
  font-size: 18px;
}

.add-btn:hover {
  background: #16a34a;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 35px rgba(22, 163, 74, 0.25);
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1200px) {
  .popular-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .popular-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .popular-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .popular-card {
    padding: 14px;
    border-radius: 18px;
  }

  .popular-img {
    height: 180px;
    border-radius: 16px;
  }

  /* mobile tab pills like screenshot */
  .popular-tabs {
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
  }

  .popular-tabs::-webkit-scrollbar {
    display: none;
  }

  .popular-tabs li {
    flex: 0 0 auto;
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 999px;
    font-size: 14px;
  }

  .popular-tabs li.active {
    background: #eaf7ef;
    color: #16a34a;
  }

  .popular-tabs li.active::after {
    display: none;
  }
}

@media (max-width: 380px) {
  .popular-grid {
    grid-template-columns: 1fr;
  }
}
/* ===================== MOBILE FIX (Zepto/Blinkit style) ===================== */
@media (max-width: 600px) {

  .popular-section{
    padding: 26px 0px;
  }

  /* 2 cards per row compact */
  .popular-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  /* compact card */
  .popular-card{
    padding: 10px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    min-height: 320px; /* keep consistent like zepto */
  }

  /* IMAGE AREA: reduce height + no huge padding */
  .popular-img{
    height: 140px;       /* IMPORTANT */
    border-radius: 14px;
    margin-bottom: 10px;
  }

  .popular-img img{
    max-width: 82%;
    max-height: 82%;
    transform: none !important;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,0.08));
  }

  /* badge smaller */
  .popular-card .badge{
    top: 10px;
    left: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }

  /* hide hover actions on mobile (zepto doesn't show these) */
  .popular-actions{
    display: none !important;
  }

  /* BODY spacing reduced */
  .popular-body{
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    flex: 1; /* makes footer stick bottom */
  }

  .popular-cat{
    font-size: 12px;
    margin-bottom: 4px;
  }

  /* title: limit lines (fix long height issue) */
  .popular-title{
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 8px;
    min-height: unset;

    display: -webkit-box;
    -webkit-line-clamp: 2;  /* max 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* rating smaller */
  .popular-rating{
    font-size: 13px;
    gap: 4px;
  }

  .popular-vendor{
    font-size: 12px;
    margin: 6px 0 10px;
  }

  /* Footer always at bottom like zepto */
  .popular-footer{
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #eef2f7;
    gap: 10px;
  }

  .popular-price strong{
    font-size: 16px;
  }

  .popular-price del{
    font-size: 12px;
    margin-left: 6px;
  }

  /* Blinkit-like button */
  .add-btn{
    padding: 8px 12px;
    min-width: 92px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 900;
    gap: 6px;
  }

  .add-btn i{
    font-size: 16px;
  }
}

/* very small phones */
@media (max-width: 380px){
  .popular-grid{
    grid-template-columns: 1fr;
  }
  .popular-card{
    min-height: unset;
  }
}
