/* =========================================================================
   GulfRabit · Catalog module (PLP, PDP, Search)
   Load after shared/css/style.css.
   ========================================================================= */

/* ---- Listing layout (sidebar + grid) --------------------------------- */
.plp { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
@media (min-width: 1024px) { .plp { grid-template-columns: 260px 1fr; } }

.plp-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.plp-count { color: var(--text-muted); font-size: var(--fs-14); }

/* ---- Filters sidebar -------------------------------------------------- */
/* On mobile the filter controls live in a bottom-sheet (opened via the Filters
   button); the inline sidebar only shows from desktop up. */
.filters { align-self: start; display: none; }
@media (min-width: 1024px) { .filters { display: block; position: sticky; top: calc(var(--header-h) + var(--space-4)); } }
.filter-group { padding: var(--space-4) 0; border-bottom: 1px solid var(--border-hairline); }
.filter-group__title { width: 100%; font-size: var(--fs-14); font-weight: var(--fw-semibold); margin-bottom: var(--space-3); display: flex; justify-content: space-between; align-items: center; background: none; border: 0; color: var(--text-primary); cursor: pointer; text-align: left; padding: 0; }
.filter-group__title:hover { color: var(--link); }
.filter-chevron { transition: transform var(--dur-base) var(--ease-out); flex-shrink: 0; }
.filter-group__title[aria-expanded="false"] { margin-bottom: 0; }
.filter-group__title[aria-expanded="false"] .filter-chevron { transform: rotate(-90deg); }
.filter-count { color: var(--text-muted); font-weight: var(--fw-regular); font-size: var(--fs-12); }
.filter-option { display: flex; align-items: center; gap: var(--space-2); padding: 4px 0; font-size: var(--fs-14); color: var(--text-secondary); cursor: pointer; }
.filter-option input { accent-color: var(--gr-cyan); width: 18px; height: 18px; }
.price-range { display: flex; align-items: center; gap: var(--space-2); }
.price-range input[type="number"] { width: 100%; }

/* Mobile filters bottom-sheet */
.filters-sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 1050; opacity: 0; transition: opacity .3s var(--ease-out); }
.filters-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1051;
  max-height: 85vh; overflow-y: auto;
  background: var(--surface-raised); border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg);
  border-top: 1px solid var(--border-hairline);
  transform: translateY(100%); transition: transform .3s var(--ease-out);
  padding: var(--space-5);
}
.filters-sheet.is-open { transform: translateY(0); }

/* ---- Product Detail (PDP) --------------------------------------------- */
.pdp { display: grid; gap: var(--space-7); grid-template-columns: 1fr; }
@media (min-width: 1024px) { .pdp { grid-template-columns: 1.1fr 1fr; align-items: start; } }

.gallery { display: grid; gap: var(--space-3); }
.gallery__main { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-hairline); background: var(--surface-sunken); aspect-ratio: 1; }
.gallery__main img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.gallery__main.zoomable:hover img { transform: scale(1.6); cursor: zoom-in; }
.gallery__thumbs { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.gallery__thumb { width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-hairline); cursor: pointer; padding: 0; background: var(--surface-sunken); }
.gallery__thumb.is-active { border-color: var(--gr-cyan-dark); box-shadow: 0 0 0 2px rgba(27,180,212,.3); }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }

.pdp-info { align-self: start; }
@media (min-width: 1024px) { .pdp-info { position: sticky; top: calc(var(--header-h) + var(--space-4)); } }
.pdp-price { display: flex; align-items: baseline; gap: var(--space-3); margin: var(--space-4) 0; }
.pdp-price__now { font-family: var(--font-display); font-size: var(--fs-31); }
.pdp-actions { display: flex; gap: var(--space-3); margin: var(--space-5) 0; }

/* ---- Tabs ------------------------------------------------------------- */
.tabs { border-bottom: 1px solid var(--border-hairline); display: flex; gap: var(--space-4); overflow-x: auto; }
.tab-btn { padding: var(--space-3) 0; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font-weight: var(--fw-medium); cursor: pointer; white-space: nowrap; }
.tab-btn.is-active { color: var(--text-primary); border-bottom-color: var(--gr-cyan); }
.tab-panel { padding-top: var(--space-5); }
.tab-panel[hidden] { display: none; }

/* ---- Spec table (industrial/B2B treatment) ---------------------------- */
.spec-table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.spec-table th, .spec-table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-hairline); }
.spec-table th { color: var(--text-muted); font-weight: var(--fw-medium); width: 40%; }
.spec-table td { font-variant-numeric: tabular-nums; }

/* ---- Reviews --------------------------------------------------------- */
.review-card { padding: var(--space-4); border: 1px solid var(--border-hairline); border-radius: var(--radius-lg); background: var(--surface-raised); }
.review-card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.review-card__stars { color: var(--lime-ink); letter-spacing: 2px; }
.review-form { padding: var(--space-5); border: 1px solid var(--border-hairline); border-radius: var(--radius-lg); background: var(--surface-sunken); }
/* Interactive star input */
.star-input { display: inline-flex; gap: 2px; }
.star-input button { background: none; border: 0; cursor: pointer; padding: 2px; line-height: 0; color: var(--border-hairline); transition: color var(--dur-fast) var(--ease-out); }
.star-input button.is-on, .star-input button.is-hover { color: var(--lime-ink); }
.star-input svg { width: 26px; height: 26px; display: block; }
.review-summary { display: flex; align-items: baseline; gap: var(--space-3); }
.review-summary__avg { font-family: var(--font-display); font-size: var(--fs-39); line-height: 1; }

/* ---- Compare table --------------------------------------------------- */
.compare-scroll { overflow-x: auto; }
.compare-table { border-collapse: collapse; width: 100%; min-width: 640px; }
.compare-table th, .compare-table td { padding: var(--space-4); border-bottom: 1px solid var(--border-hairline); text-align: left; vertical-align: top; }
.compare-table thead th { border-bottom: 1px solid var(--border-hairline); }
.compare-table__row-label { color: var(--text-muted); font-weight: var(--fw-medium); font-size: var(--fs-14); white-space: nowrap; width: 160px; position: sticky; left: 0; background: var(--surface-page); }
.compare-col { min-width: 200px; }
.compare-col__media { aspect-ratio: 4/5; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-hairline); background: var(--surface-sunken); margin-bottom: var(--space-3); position: relative; }
.compare-col__media img { width: 100%; height: 100%; object-fit: cover; }
.compare-col__remove { position: absolute; top: 8px; right: 8px; }
.compare-table .tabular { font-variant-numeric: tabular-nums; }
.compare-best { color: var(--lime-ink); font-weight: var(--fw-semibold); }

/* ---- Chips (active filters) ------------------------------------------ */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--surface-sunken); border: 1px solid var(--border-hairline); font-size: var(--fs-12); }
.chip button { background: none; border: 0; color: var(--text-muted); cursor: pointer; }

/* ---- Order channels (WhatsApp / Messenger) ---------------------------
   Sit under the wishlist button. flex-basis is set so the pair wraps to a
   stacked full-width layout once the buy column drops under ~400px. */
.order-channels { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }
.order-channel { flex: 1 1 190px; }
.order-channel__icon { flex-shrink: 0; }

/* ---- Spec tab section headings + barcode ------------------------------ */
.spec-heading { margin: var(--space-6) 0 var(--space-3); font-family: var(--font-body); font-size: var(--fs-12); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.spec-heading:first-child { margin-top: 0; }
/* Loosened tracking so a 13-digit code can be read off the screen and checked
   against the physical pack — the whole point of publishing it. */
.barcode-value { font-variant-numeric: tabular-nums; letter-spacing: .1em; }

/* ---- Product FAQ ------------------------------------------------------
   Native <details> rather than a JS accordion: it is keyboard-accessible for
   free and the browser's find-in-page can reach closed answers. */
.faq-list { max-width: 70ch; }
.faq-item { border-bottom: 1px solid var(--border-hairline); }
.faq-item__q {
  padding: var(--space-4) 0;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.faq-item__q::-webkit-details-marker { display: none; }
/* Own marker so the affordance survives the list-style reset above. */
.faq-item__q::after {
  content: "";
  width: 9px; height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform var(--dur-base) var(--ease-out);
  flex-shrink: 0;
}
.faq-item[open] .faq-item__q::after { transform: rotate(-135deg); }
.faq-item__q:hover { color: var(--link); }
.faq-item__a {
  padding-bottom: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
