/* ============================================================
   PDPLUS Product Card — Redesign v1
   One accent color (WhatsApp green), clean hierarchy,
   progressive disclosure on hover-capable devices.
   Upload to: pdplus.app/assets/css/product-card.css
   ============================================================ */

:root {
  --pd-cta:            #25D366;  /* WhatsApp green — primary action ONLY */
  --pd-cta-hover:      #1fa954;
  --pd-accent-urgent:  #FF6B35;  /* coral — scarcity/deal badges ONLY */
  --pd-accent-trust:   #17A2B8;  /* teal — verified badge ONLY */
  --pd-text:           #222222;  /* ink black — titles, prices */
  --pd-text-muted:     #6a6a6a;  /* ash gray — secondary info */
  --pd-surface:        #ffffff;
  --pd-border:         #dddddd;  /* hairline separators */
  --pd-radius:         12px;
  --pd-font: -apple-system, system-ui, "Segoe UI", Roboto, "Inter", sans-serif;
}

/* ---- Card shell ---- */
.pd-card {
  font-family: var(--pd-font);
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease;
}

/* ---- Image ---- */
.pd-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f2f2f2;
  overflow: hidden;
}

.pd-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback when product has no photo — neutral box, NOT a letter avatar */
.pd-card__media--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0b0b0;
  font-size: 13px;
  font-weight: 500;
}

/* photo count chip (only rendered if >1 photo) */
.pd-card__photos {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
}

/* scarcity badge on image (only when stock <= 5) */
.pd-card__scarcity {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--pd-accent-urgent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

/* discount badge (deals listings only — price meaningfully below market_high) */
.pd-card__discount {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--pd-accent-urgent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

/* ---- Body ---- */
.pd-card__body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.pd-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--pd-text);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em; /* keeps grid rows aligned */
}

.pd-card__price {
  font-size: 19px;
  font-weight: 700;
  color: var(--pd-text);
  margin: 0;
}

/* Market range — the price-transparency differentiator.
   Visible but quiet: small, gray, one line. */
.pd-card__market {
  font-size: 12px;
  color: var(--pd-text-muted);
  margin: 0;
}

/* ---- Trust row ---- */
.pd-card__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--pd-text-muted);
  margin: 2px 0 4px;
}

.pd-card__trust .pd-verified { color: var(--pd-accent-trust); font-weight: 600; }

/* ---- Primary CTA (the ONE button) ---- */
.pd-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  margin-top: auto;
  background: var(--pd-cta);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, transform .1s ease;
}

.pd-card__cta:hover  { background: var(--pd-cta-hover); }
.pd-card__cta:active { transform: scale(.97); }

/* ---- Secondary actions (save / share) ---- */
.pd-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pd-card__action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: #f7f7f7;
  border: 1px solid var(--pd-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--pd-text);
  cursor: pointer;
  transition: background .15s ease;
}

.pd-card__action-btn:hover { background: #efefef; }

/* ---- Share menu (popover) ---- */
.pd-share {
  position: relative;
}

.pd-share__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 40;
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  padding: 8px;
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  min-width: 260px;
}

.pd-share__menu.is-open { display: grid; }

.pd-share__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  color: var(--pd-text-muted);
  cursor: pointer;
}

.pd-share__item:hover { background: #f2f2f2; }
.pd-share__item .icon { font-size: 20px; line-height: 1; }

/* copied-link feedback */
.pd-share__toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pd-text);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.pd-share__toast.is-visible { opacity: 1; }

/* ============================================================
   Progressive disclosure — DESKTOP (hover-capable) only.
   On touch devices everything important stays visible.
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  .pd-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .10);
  }

  /* market range + secondary actions fade in on hover */
  .pd-card__market,
  .pd-card__actions {
    opacity: 0;
    transition: opacity .25s ease;
  }

  .pd-card:hover .pd-card__market,
  .pd-card:hover .pd-card__actions,
  .pd-card:focus-within .pd-card__market,
  .pd-card:focus-within .pd-card__actions {
    opacity: 1;
  }
}

/* ---- Theme overrides ----
   The site's global stylesheet targets h3/p/strong directly (serif headings,
   orange prices), which beats inherited styles. Pin the card's own look. */
.pd-card,
.pd-card h3,
.pd-card__title,
.pd-card__title a {
  font-family: var(--pd-font) !important;
}

.pd-card__title,
.pd-card__title a {
  color: var(--pd-text) !important;
}

.pd-card__price {
  color: var(--pd-text) !important;
  font-family: var(--pd-font) !important;
}

.pd-card__market,
.pd-card__trust {
  color: var(--pd-text-muted) !important;
}

.pd-card p { margin: 0; }

/* ---- Serif headings — page-level H1/H2/H3 outside cards ---- */
.pd-page-heading,
body > h1, body > h2, body > h3,
.page-title, .section-title, .category-title {
  font-family: Georgia, "Times New Roman", Times, serif;
  letter-spacing: -.01em;
}

/* ---- Save button — saved state ---- */
.pd-card__action-btn[data-pd-save].is-saved {
  color: #e03131;
  border-color: #ffc9c9;
  background: #fff5f5;
}

.pd-card__action-btn[data-pd-save].is-saved::before {
  content: "♥ ";
}

/* ---- Grid helper for listing pages ---- */
.pd-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .pd-card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pd-card__body { padding: 10px; }
  .pd-card__price { font-size: 17px; }
  .pd-card__cta { font-size: 13px; padding: 10px; }
}
