/*
 * SOKONI COMPACT PREMIUM GRID SYSTEM
 * Applies to all product / service pages
 * Mobile  : 4 cols  → ~24 products in one viewport (no scroll)
 * Tablet  : 5 cols  → ~20 products above fold
 * Desktop : 7 cols  → ~28+ products above fold
 * Each card: image + name (2 lines) + price + rating + location
 */

/* ════════════════════════════════════════════════════════
   ROOT VARIABLES
════════════════════════════════════════════════════════ */
:root {
  --card-radius:    10px;
  --card-bg:        rgba(18,18,18,0.95);
  --card-border:    rgba(255,255,255,0.07);
  --card-hover-border: rgba(113,255,0,0.3);
  --card-gap:       6px;
  --card-img-ratio: 0.9;     /* image height = card-width × ratio */
  --card-pad:       6px 7px 7px;
  --name-size:      11px;
  --price-size:     12px;
  --meta-size:      9px;
}

/* ════════════════════════════════════════════════════════
   UNIVERSAL GRID OVERRIDE
   Targets both .products-grid and .ptrend-grid
════════════════════════════════════════════════════════ */
.products-grid,
.ptrend-grid,
#productsContainer,
#flashProductsGrid,
.flash-products-grid,
.sv-grid,
.hc-grid,
.lawyers-grid {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  gap: var(--card-gap) !important;
  padding: 6px 16px 16px !important;
  width: 100% !important;
}

/* ════════════════════════════════════════════════════════
   UNIVERSAL CARD OVERRIDE
════════════════════════════════════════════════════════ */
.products-grid .product-card,
.ptrend-grid .product-card,
.flash-product-card,
.b2-product-card,
.hc-card,
.lawyer-card {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: var(--card-radius) !important;
  overflow: hidden !important;
  cursor: pointer !important;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  will-change: transform !important;
}

.products-grid .product-card:hover,
.ptrend-grid .product-card:hover,
.flash-product-card:hover {
  transform: translateY(-2px) scale(1.015) !important;
  border-color: var(--card-hover-border) !important;
  box-shadow: 0 4px 18px rgba(113,255,0,0.1) !important;
  z-index: 2 !important;
}

/* ════════════════════════════════════════════════════════
   IMAGE WRAPPER — square-ish, fills top of card
════════════════════════════════════════════════════════ */
.products-grid .product-img-wrap,
.ptrend-grid .product-img-wrap {
  width: 100% !important;
  aspect-ratio: 1 / 0.92 !important;
  overflow: hidden !important;
  position: relative !important;
  flex-shrink: 0 !important;
  height: auto !important;          /* override inline height */
}

.products-grid .product-card img,
.products-grid .product-img-wrap img,
.ptrend-grid .product-img-wrap img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  transition: transform 0.25s ease !important;
}

.products-grid .product-card:hover img,
.ptrend-grid .product-card:hover img {
  transform: scale(1.06) !important;
}

/* Dark gradient at image bottom — price readability */
.products-grid .product-img-wrap::after,
.ptrend-grid .product-img-wrap::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important; left: 0 !important; right: 0 !important;
  height: 55% !important;
  background: linear-gradient(to top, rgba(8,8,8,0.82) 0%, transparent 100%) !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

/* ════════════════════════════════════════════════════════
   CATEGORY BADGE — overlaid top-left on image
════════════════════════════════════════════════════════ */
.products-grid .loc-tag,
.ptrend-grid .loc-tag {
  position: absolute !important;
  top: 4px !important;
  left: 4px !important;
  z-index: 3 !important;
  font-size: 8px !important;
  font-weight: 800 !important;
  padding: 2px 5px !important;
  border-radius: 4px !important;
  background: rgba(0,0,0,0.65) !important;
  color: rgba(255,255,255,0.75) !important;
  border: none !important;
  backdrop-filter: blur(4px) !important;
  white-space: nowrap !important;
  max-width: 90% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ════════════════════════════════════════════════════════
   CARD BODY — compact info panel
════════════════════════════════════════════════════════ */
.products-grid .product-body,
.ptrend-grid .product-body {
  padding: var(--card-pad) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  flex: 1 !important;
}

/* Product name — 2 lines, clean truncation */
.products-grid .product-name,
.ptrend-grid .product-name {
  font-size: var(--name-size) !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,0.92) !important;
  line-height: 1.3 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  max-height: 2.6em !important;
  margin: 0 !important;
}

/* Price + rating on one line */
.products-grid .product-top-row,
.ptrend-grid .product-top-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin: 0 !important;
  gap: 3px !important;
}

.products-grid .price,
.ptrend-grid .price {
  font-size: var(--price-size) !important;
  font-weight: 900 !important;
  color: #71ff00 !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
  letter-spacing: -0.2px !important;
}

.products-grid .rating-stars,
.ptrend-grid .rating-stars {
  font-size: 8px !important;
  color: rgba(255,255,255,0.35) !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* Seller name — tiny, muted */
.products-grid .seller-tag,
.ptrend-grid .seller-tag {
  font-size: 8px !important;
  color: rgba(255,255,255,0.3) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
}

/* Hide bulky elements: description, big action buttons */
.products-grid .product-desc,
.ptrend-grid .product-desc { display: none !important; }

.products-grid .product-actions,
.ptrend-grid .product-actions {
  display: none !important;       /* hidden — tap card to open */
}

/* Show a tiny cart icon on hover */
.products-grid .product-card:hover .product-actions,
.ptrend-grid .product-card:hover .product-actions {
  display: flex !important;
  gap: 4px !important;
  margin-top: 4px !important;
}

.products-grid .product-card:hover .add-to-cart-btn,
.ptrend-grid .product-card:hover .add-to-cart-btn {
  flex: 1 !important;
  padding: 5px 6px !important;
  font-size: 9px !important;
  border-radius: 6px !important;
}

.products-grid .product-card:hover .wishlist-btn,
.ptrend-grid .product-card:hover .wishlist-btn {
  padding: 5px 7px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
}

/* Flash sale card: keep discount badge */
.flash-product-card .discount-badge {
  position: absolute !important;
  top: 5px !important; right: 5px !important;
  font-size: 8px !important; font-weight: 900 !important;
  background: rgba(255,60,60,0.9) !important;
  color: white !important; padding: 2px 5px !important;
  border-radius: 5px !important; z-index: 4 !important;
}

/* Stock bar: compact */
.products-grid .stock-bar-wrap,
.ptrend-grid .stock-bar-wrap {
  height: 3px !important;
  margin-top: 3px !important;
  border-radius: 2px !important;
}

/* ════════════════════════════════════════════════════════
   BADGE OVERLAYS on image
════════════════════════════════════════════════════════ */
.product-img-wrap .product-badge,
.product-img-wrap .trending-badge,
.product-img-wrap .flash-badge,
.product-img-wrap .new-badge {
  position: absolute !important;
  top: 4px !important; right: 4px !important;
  font-size: 7px !important; font-weight: 900 !important;
  padding: 2px 5px !important; border-radius: 4px !important;
  z-index: 4 !important; white-space: nowrap !important;
  text-transform: uppercase !important; letter-spacing: 0.3px !important;
}

/* ════════════════════════════════════════════════════════
   DESKTOP LARGE — 7 columns, larger cards with full info
════════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
  :root { --name-size: 12px; --price-size: 13px; --card-gap: 8px; }
  .products-grid,
  .ptrend-grid,
  #productsContainer,
  #flashProductsGrid { grid-template-columns: repeat(8, 1fr) !important; padding: 8px 24px 20px !important; }
}

@media (min-width: 901px) and (max-width: 1279px) {
  :root { --name-size: 11px; --price-size: 12px; --card-gap: 7px; }
  .products-grid,
  .ptrend-grid,
  #productsContainer,
  #flashProductsGrid { grid-template-columns: repeat(7, 1fr) !important; padding: 6px 18px 18px !important; }
}

/* ════════════════════════════════════════════════════════
   TABLET — 5 columns, cards comfortably info-rich
════════════════════════════════════════════════════════ */
@media (min-width: 601px) and (max-width: 900px) {
  :root { --name-size: 11px; --price-size: 12px; --card-gap: 6px; }
  .products-grid,
  .ptrend-grid,
  #productsContainer,
  #flashProductsGrid { grid-template-columns: repeat(5, 1fr) !important; padding: 6px 14px 16px !important; }
  .products-grid .product-actions,
  .ptrend-grid .product-actions { display: none !important; }
}

/* ════════════════════════════════════════════════════════
   MOBILE — 4 columns: ~24 products in one phone screen
   Each card ~88×118px on a 375px phone
════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  :root { --name-size: 9.5px; --price-size: 10px; --meta-size: 8px; --card-gap: 3px; --card-pad: 4px 5px 5px; }

  .products-grid,
  .ptrend-grid,
  #productsContainer,
  #flashProductsGrid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 3px !important;
    padding: 3px 8px 12px !important;
  }

  /* Keep image square-ish, smaller */
  .products-grid .product-img-wrap,
  .ptrend-grid .product-img-wrap { aspect-ratio: 1 / 0.85 !important; }

  /* Show seller tag on mobile — helps users identify quickly */
  .products-grid .seller-tag,
  .ptrend-grid .seller-tag { display: block !important; font-size: 7.5px !important; }

  /* Rating on its own row on mobile */
  .products-grid .rating-stars,
  .ptrend-grid .rating-stars { font-size: 7.5px !important; }

  /* Actions: always hidden on mobile (tap to open) */
  .products-grid .product-actions,
  .ptrend-grid .product-actions { display: none !important; }

  .products-grid .product-card:hover .product-actions,
  .ptrend-grid .product-card:hover .product-actions { display: none !important; }

  /* Reduce hover effect on touch */
  .products-grid .product-card:hover,
  .ptrend-grid .product-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  .products-grid .product-card:active,
  .ptrend-grid .product-card:active {
    transform: scale(0.97) !important;
    opacity: 0.88 !important;
  }
}

/* ════════════════════════════════════════════════════════
   VERY SMALL PHONES (< 360px) — 4 cols still, tighter
════════════════════════════════════════════════════════ */
@media (max-width: 359px) {
  :root { --name-size: 8.5px; --price-size: 9px; --card-gap: 2px; }
  .products-grid,
  .ptrend-grid,
  #productsContainer { grid-template-columns: repeat(4, 1fr) !important; gap: 2px !important; padding: 2px 6px 10px !important; }
}

/* ════════════════════════════════════════════════════════
   SECTION HEADERS — tighter on all screens
════════════════════════════════════════════════════════ */
.ptrend-header { padding: 12px 16px 8px !important; }
.ptrend-pills  { padding: 0 16px 8px !important; }
.ptrend-h2     { font-size: 16px !important; }

@media (max-width: 600px) {
  .ptrend-header { padding: 10px 10px 6px !important; }
  .ptrend-pills  { padding: 0 8px 6px !important; }
  .ptrend-h2     { font-size: 14px !important; }
}

/* ════════════════════════════════════════════════════════
   FLASH SALE GRID
════════════════════════════════════════════════════════ */
.flash-products-grid,
#flashProductsGrid {
  grid-template-columns: repeat(7, 1fr) !important;
}
@media (max-width: 600px) {
  .flash-products-grid,
  #flashProductsGrid { grid-template-columns: repeat(4, 1fr) !important; }
}
.flash-product-card .product-buttons { display: none !important; }
.flash-product-card:hover .product-buttons {
  display: flex !important; padding: 5px 6px !important; gap: 4px !important;
}
.flash-product-card:hover .product-btn {
  flex: 1 !important; padding: 5px !important; font-size: 8px !important;
}

/* ════════════════════════════════════════════════════════
   CATEGORY PAGE
════════════════════════════════════════════════════════ */
.cat-products-grid,
#catProductsGrid,
.category-grid {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  gap: var(--card-gap) !important;
  padding: 8px 16px 16px !important;
}
@media (max-width: 600px) {
  .cat-products-grid,
  #catProductsGrid,
  .category-grid { grid-template-columns: repeat(4, 1fr) !important; padding: 3px 8px 12px !important; gap: 3px !important; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .cat-products-grid,
  #catProductsGrid,
  .category-grid { grid-template-columns: repeat(5, 1fr) !important; }
}

/* ════════════════════════════════════════════════════════
   SERVICE CARDS — more compact on desktop
════════════════════════════════════════════════════════ */
.sv-grid {
  grid-template-columns: repeat(6, 1fr) !important;
}
.sv-card-emoji { height: 80px !important; font-size: 36px !important; }
.sv-card-title { font-size: 11px !important; }
.sv-card-seller{ font-size: 9px !important; }
.sv-card-price { font-size: 12px !important; margin-bottom: 6px !important; }
.sv-book-btn   { padding: 8px !important; font-size: 11px !important; }

@media (max-width: 600px) {
  .sv-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 5px !important; padding: 4px 8px 12px !important; }
  .sv-card-emoji { height: 60px !important; font-size: 26px !important; }
}

/* ════════════════════════════════════════════════════════
   HEALTHCARE GRID — tighter, 4 cols desktop
════════════════════════════════════════════════════════ */
.hc-grid {
  grid-template-columns: repeat(4, 1fr) !important;
}
@media (max-width: 600px) {
  .hc-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
}

/* ════════════════════════════════════════════════════════
   LAWYER CARDS GRID
════════════════════════════════════════════════════════ */
.lawyers-grid {
  grid-template-columns: repeat(4, 1fr) !important;
}
@media (max-width: 600px) {
  .lawyers-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ════════════════════════════════════════════════════════
   PROPERTY / BNB GRIDS
════════════════════════════════════════════════════════ */
.prop-grid,
.bnb-grid,
.cr-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
}
@media (max-width: 600px) {
  .prop-grid,
  .bnb-grid,
  .cr-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
}

/* ════════════════════════════════════════════════════════
   SCROLLBAR POLISH
════════════════════════════════════════════════════════ */
body::-webkit-scrollbar { width: 4px; }
body::-webkit-scrollbar-track { background: #0a0a0a; }
body::-webkit-scrollbar-thumb { background: rgba(113,255,0,0.3); border-radius: 2px; }
body::-webkit-scrollbar-thumb:hover { background: rgba(113,255,0,0.5); }

/* ════════════════════════════════════════════════════════
   REMOVE EXCESSIVE PAGE PADDING — no wasted whitespace
════════════════════════════════════════════════════════ */
.sv-body,
.cr-body,
.hc-body {
  padding-top: 16px !important;
  padding-bottom: 80px !important;
}
.law-body { padding-top: 20px !important; }

/* Category page search / filter bar — slimmer */
.cat-page-header { padding: 16px 24px 14px !important; }
@media (max-width: 600px) {
  .cat-page-header { padding: 10px 12px 10px !important; }
}
