/* ---------- Grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin: 28px 24px 8px 24px !important; /* Generous side margins for wide screens */
  justify-content: center; /* Center align cards so center gaps match edge gaps */
}

/* On small screens, reduce side margins for full width */
@media (max-width: 640px) {
  .product-grid {
    margin-left: 4px !important;
    margin-right: 4px !important;
    gap: 16px;
  }
}

/* ---------- Card ---------- */
/* === Product Card Container === */
.product-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  /* thin outline for crisp edge */
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.12),
    /* main soft shadow */
    0 0 0 2px rgba(255, 255, 255, 0.5) inset;
  /* faint inner glow for depth */
  overflow: hidden;
  /* ensures child elements like button align perfectly */
  background-color: #fff;
}

/* === Card Content (above the button) === */
.product-card-content {
  flex-grow: 1;
  padding: 1rem;
}

/* ---------- Media ---------- */
.product-media {
  position: relative;
  background: #f7f7f8;
  max-height: 360px;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity .25s ease;
  background: #fff; 
}

/* ---------- Body ---------- */
.product-body {
  padding: 8px;
  padding-bottom: 0;
  display: grid;
  gap: 0;
}

.product-title {
  margin: 0 !important;
  font-size: 1.45rem;
  /* larger, shopping-like */
  font-weight: 700;
  color: #111;
  /* line-height: 1.3; */
}

.product-writeup {
  margin: 0;
  font-size: 0.80rem;
  /* slightly smaller, secondary info */
  color: #333;
  text-align: justify;
  text-indent: 1.5em;
  /* 👈 adds tab-style indent */
}

/* ---------- Rating (dynamic, capped at 5) ---------- */
.meta-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.stars {
  --rating: 0;
  /* 0..5 set inline */
  --percent: calc((min(max(var(--rating), 0), 5) / 5) * 100%);
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: .12em;
  background: linear-gradient(90deg, #f5b50a var(--percent), #e5e7eb var(--percent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* reveal gradient */
}

.ratings-count {
  font-size: 0.8rem;
  color: #666;
}

/* ---------- Pricing ---------- */
.price-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}

.current-price {
  font-size: 1.3rem;
  /* more prominence */
  font-weight: 800;
  color: #000;
}

.old-price {
  color: #888;
  font-size: 0.9rem;
  text-decoration: line-through;
}

.discount {
  color: #28a745;
  font-weight: 700;
  font-size: 1rem;
  /* slight boost to show value */
}


.expiry {
  margin-left: auto;
  font-size: .8rem;
  color: #6b7280;
}

/* ---------- Pros / Cons ---------- */
.pc {
  display: grid;
  gap: .25rem;
}

.pc h4 {
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
  color: #222;
}

.pc ul {
  margin: .25rem 0 0;
  padding-left: 1rem;
  color: #3a3a3a;
  font-size: .9rem;
}

.pc li {
  margin: .15rem 0;
}

/* === Footer (Ensure Button Flush to Card Edges) === */
.card-footer {
  margin-top: auto;
  padding: 0;
}

/* === Buy Button (Slimmer, with Icon) === */
.buy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* space between icon & text */
  width: 100%;
  padding: 0.45rem 0.9rem;
  /* reduced height */
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  --md-accent-fg-color: #ffffff !important;
}

/* Icon styling */
.buy-btn i {
  display: inline-flex;
  font-size: 1.1rem;
  line-height: 1;
  color: #232F3E;
}



/* === Mobile Adjustments === */
@media (max-width: 640px) {
  .buy-btn {
    font-size: 0.95rem;
    padding: 0.65rem;
    /* still touch-friendly */
  }
}



/* ---------- Mobile tweaks ---------- */
@media (max-width: 640px) {

  .product-title {
    font-size: 1.05rem;
  }

  .product-writeup {
    font-size: .92rem;
  }

  .product-media {
    aspect-ratio: 4 / 3;
  }

  /* taller images on phones */
}

@media (max-width: 420px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .price-row {
    gap: .35rem;
  }

  .stars {
    font-size: .95rem;
  }
}

/* Reduced motion friendly */
@media (prefers-reduced-motion: reduce) {

  .product-card,
  .product-media img,
  .buy-btn {
    transition: none;
  }
}


/* === Reasons to Buy (Balanced, Aligned) === */
.pros {
  background-color: #F6FFF6;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0px -16px;
}

.pros h4 {
  color: #2E7D32;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.pros ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pros li {
  padding-left: 2px;
  position: relative;
  margin-bottom: 2px;
  font-size: 0.80rem;
  /* increased for readability */
  color: #333;
  line-height: 1.2;
  /* ensures alignment with bullet */
}

.pros li::before {
  content: "✔";
  color: #43A047;
  font-size: 0.80rem;
  position: absolute;
  left: -20px;
  top: 0.08rem;
  /* aligned vertically with text */
}

/* === Reasons to Avoid (Balanced, Aligned) === */
.cons {
  background-color: #FFFDF6;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0px -16px;
}

.cons h4 {
  color: #F57C00;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.cons ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cons li {
  padding-left: 2px;
  position: relative;
  margin-bottom: 2px;
  font-size: 0.80rem;
  /* increased for readability */
  color: #333;
  line-height: 1.4;
}

.cons li::before {
  content: "✖";
  color: #F57C00;
  font-size: 0.80rem;
  position: absolute;
  left: -20px;
  top: 0.08rem;
}

.admonition.tip>.admonition-title {
  font-weight: 500;
  font-size: 0.75rem;
  color: #444;
}

.admonition.abstract>.admonition-title {
  font-weight: 500;
  font-size: 0.75rem;
  color: #444;
}

.admonition.tip {
  margin-top:  0;
  margin-bottom: 8px;
}

.admonition.abstract {
  margin-top:  0;
  margin-bottom: 8px;
}



/* Top pick and Value pick CSS */

/* ---------- Card Badges (top-left) ---------- */
.card-badges {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 4px;
  z-index: 1;
  /* above image but below nav/header */
  pointer-events: none;
  /* badges don't block clicks */
}

/* Base badge look (compact) */
.card-badge {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 0.65rem;
  line-height: 1;
  font-weight: 600;
  color: #fff;
  background: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Top Pick (gold, subtle) */
.card-badge--top-pick {
  background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
  color: #1f2937;
  /* dark text for readability */
}

/* Value Pick (green, subtle) */
.card-badge--value-pick {
  background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
}

.card-badge--best-deal {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

/* Small icon inside badge */
.card-badge i {
  font-size: 0.75rem;
  opacity: 0.85;
}

/* Product Number Badge */
.product-number {
  position: absolute;
  top: 6px;
  right: 6px;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px; /* keeps round shape if single digit */
  height: 22px;
  padding: 0 6px;
  border-radius: 9999px; /* pill/circle look */
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  text-align: center;
  white-space: nowrap;
}