/*
 * shop.css — Shop & Product Archive Pages — Rawaa Beauty
 * Depends on: style.css (design tokens), woocommerce.css
 */

/* ============================================================
   Body reset: WooCommerce adds .woocommerce body class which
   woocommerce.css targets with `padding: 100px …`. Since
   .rb-shop-page handles all spacing, we reset that here.
   ============================================================ */
body.woocommerce.woocommerce-page.woocommerce-archive,
body.woocommerce.woocommerce-page.woocommerce-shop {
  padding: 0 !important;
  max-width: 100% !important;
}

/* ============================================================
   Page wrapper
   ============================================================ */
.rb-shop-page {
  padding-top: 96px;   /* clear fixed header (72px) + breathing room */
  padding-bottom: 80px;
  min-height: 60vh;
}

/* ── Page heading (title + result count) ── */
.rb-shop-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.rb-shop-title {
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  font-weight: 700;
  color: var(--c-ink);
  margin: 0;
}
.rb-shop-title::after {
  content: '';
  display: block;
  width: 44px;
  height: 3px;
  background: linear-gradient(90deg, var(--c-rose-deep), var(--c-peach));
  border-radius: 2px;
  margin-top: 8px;
}

.rb-shop-count {
  font-size: 13px;
  color: var(--c-muted);
  white-space: nowrap;
}
/* WC wraps result count in <p> */
.rb-shop-count p,
.woocommerce-result-count {
  margin: 0;
  font-size: 13px;
  color: var(--c-muted);
}

/* ============================================================
   Mobile filter toggle button (hidden on desktop)
   ============================================================ */
.rb-filter-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 50px;
  background: var(--c-blush);
  border: 1px solid var(--c-rose);
  color: var(--c-ink);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  position: relative;
  margin-bottom: 20px;
  transition: background .22s, border-color .22s;
}
.rb-filter-toggle:hover {
  background: var(--c-rose);
  border-color: var(--c-rose-deep);
}
/* Active filter indicator dot */
.rb-filter-badge {
  position: absolute;
  top: 7px;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-rose-deep);
  border: 2px solid var(--c-white);
}

/* ============================================================
   Main layout: sidebar (right in RTL) + products (left)
   ============================================================ */
.rb-shop-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

/* ============================================================
   Sidebar
   ============================================================ */
.rb-shop-sidebar {
  flex-shrink: 0;
  width: 256px;
  position: sticky;
  top: 88px;   /* below fixed header */
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-rose) transparent;
}
.rb-shop-sidebar::-webkit-scrollbar { width: 4px; }
.rb-shop-sidebar::-webkit-scrollbar-thumb { background: var(--c-rose); border-radius: 2px; }

/* Close button (mobile only — hidden on desktop) */
.rb-sidebar-close {
  display: none;
  position: absolute;
  top: 14px;
  left: 14px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--c-ink);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .2s;
}
.rb-sidebar-close:hover { background: var(--c-blush); }

.rb-sidebar-inner {
  background: var(--c-white);
  border: 1px solid var(--c-rose);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Filter form groups
   ============================================================ */
.rb-filter-form { margin: 0; }

.rb-filter-group {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--c-blush);
}
.rb-filter-group:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.rb-filter-title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* Orderby radio buttons */
.rb-filter-radios {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.rb-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--c-text);
  line-height: 1.4;
  transition: color .2s;
}
.rb-radio-label:hover { color: var(--c-rose-deep); }
.rb-radio-label input[type="radio"] {
  accent-color: var(--c-rose-deep);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Category list */
.rb-filter-cats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rb-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--c-text);
  text-decoration: none;
  transition: background .2s, color .2s;
}
.rb-cat-link:hover {
  background: var(--c-blush);
  color: var(--c-rose-deep);
}
.rb-cat-link.is-active {
  background: var(--c-blush);
  color: var(--c-rose-deep);
  font-weight: 700;
}
.rb-cat-count {
  font-size: 12px;
  color: var(--c-muted);
  flex-shrink: 0;
}

/* Price range inputs */
.rb-price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.rb-price-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--c-rose);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--c-ink);
  background: var(--c-cream);
  outline: none;
  transition: border-color .22s, box-shadow .22s;
  direction: ltr;
  text-align: center;
}
.rb-price-input:focus {
  border-color: var(--c-rose-deep);
  box-shadow: 0 0 0 3px rgba(217,138,147,.15);
}
.rb-price-input::placeholder { color: var(--c-muted); }
.rb-price-sep {
  color: var(--c-muted);
  font-weight: 700;
  flex-shrink: 0;
  font-size: 14px;
}

/* Apply button */
.rb-filter-apply {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--c-ink);
  color: var(--c-white);
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .22s, transform .2s;
}
.rb-filter-apply:hover {
  background: var(--c-rose-deep);
  transform: translateY(-1px);
}

/* Reset link */
.rb-filter-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--c-muted);
  text-decoration: none;
  transition: color .2s;
  padding: 6px;
}
.rb-filter-reset:hover { color: var(--c-rose-deep); }

/* ============================================================
   Products area
   ============================================================ */
.rb-shop-products {
  flex: 1;
  min-width: 0;
}

/* 3-col grid (narrower than homepage 4-col because sidebar is present) */
.rb-shop-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

/* Out-of-stock variant */
.rb-btn-out-of-stock {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--c-blush);
  color: var(--c-muted);
  border: 1px solid var(--c-rose);
  border-radius: 50px;
  text-align: center;
  text-decoration: none;
  cursor: not-allowed;
  font-family: var(--font-body);
}

/* ── No products ── */
.rb-no-products-found {
  text-align: center;
  padding: 80px 24px;
}
.rb-no-products-found p {
  color: var(--c-muted);
  font-size: 16px;
  margin-bottom: 24px;
}

/* ── Pagination ── */
.rb-shop-pagination {
  margin-top: 48px;
  display: flex;
  justify-content: center;
}
.rb-shop-pagination .woocommerce-pagination { margin: 0; }
.rb-shop-pagination .woocommerce-pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: center;
}
.rb-shop-pagination .woocommerce-pagination ul li a,
.rb-shop-pagination .woocommerce-pagination ul li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--c-ink);
  background: var(--c-white);
  border: 1px solid var(--c-rose);
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.rb-shop-pagination .woocommerce-pagination ul li a:hover {
  background: var(--c-blush);
  border-color: var(--c-rose-deep);
  color: var(--c-rose-deep);
}
.rb-shop-pagination .woocommerce-pagination ul li span.current {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-white);
}

/* ── Mobile sidebar backdrop ── */
.rb-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(42,36,34,.52);
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.rb-sidebar-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Medium desktop: 3-col sidebar layout is fine */
@media (max-width: 1100px) {
  .rb-shop-sidebar { width: 224px; }
  .rb-shop-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Tablet / mobile breakpoint */
@media (max-width: 768px) {
  .rb-shop-page {
    padding-top: 80px;
    padding-bottom: 56px;
  }

  /* Show filter toggle */
  .rb-filter-toggle { display: inline-flex; }

  /* Single-column layout on mobile */
  .rb-shop-layout { display: block; }

  /* Sidebar: fixed slide-in drawer from the right (RTL start) */
  .rb-shop-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(300px, 90vw);
    height: 100%;
    max-height: 100%;
    z-index: 9001;
    background: var(--c-cream);
    box-shadow: -10px 0 40px rgba(42,36,34,.18);
    transition: right .38s cubic-bezier(.22,1,.36,1);
    overflow-y: auto;
    padding: 56px 0 48px;
  }
  .rb-shop-sidebar.is-open { right: 0; }

  .rb-sidebar-close { display: inline-flex; }

  .rb-sidebar-overlay { display: block; }

  .rb-sidebar-inner {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 20px;
  }

  /* 2-col product grid on mobile */
  .rb-shop-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .rb-shop-pagination { margin-top: 32px; }
}

/* Very small screens */
@media (max-width: 420px) {
  .rb-shop-page { padding-top: 72px; }
  .rb-shop-grid { gap: 10px !important; }
  .rb-shop-pagination .woocommerce-pagination ul li a,
  .rb-shop-pagination .woocommerce-pagination ul li span {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }
}
