/* === products.css === */
/* ---------------------------------------------------------------------------
products.css

Lifted verbatim out of views/products.ejs (an inline <style> block). The template now
links this file from the exact spot the block occupied, because that position
decides which declarations win ties against the core stylesheet.
--------------------------------------------------------------------------- */

.variations {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.variation-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #ddd;
  vertical-align: middle;
}

.variations a.selected .variation-icon {
  border: 2px solid #000;
  transform: scale(1.1);
}

/* Brand Grid Styles */
.brand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-top: 15px;
}

.brand-item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid #eee;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: #fff;
  min-width: 100px;
  min-height: 60px;
}

.brand-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #ddd;
  transform: translateY(-2px);
}

.brand-image {
  max-width: 120px;
  max-height: 100px;
  object-fit: contain;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.brand-item:hover .brand-image {
  filter: grayscale(0%);
}

.brand-name {
  color: #333;
  font-weight: 500;
  padding: 5px;
}

/* Subcategory Grid Styles */
.subcategory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 15px;
}

.subcategory-pill {
  display: inline-block;
  margin: 0;
  padding: 10px 20px;
  background: #fff;
  border: 3px solid #aaa;
  border-radius: 30px;
  color: #333;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: normal;
  word-spacing: normal;
  text-transform: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.subcategory-pill a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

/*
.subcategory-pill:hover {
background: #002b58;
color: #fff;
border-color: #002b58;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 43, 88, 0.15);
text-decoration: none;
} */

.subcategory-count {
  display: inline-block;
  margin: 0 0 0 8px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  background: #002b58;
  color: #fff;
}

html[dir='rtl'] .subcategory-count {
  margin: 0 8px 0 0;
}

/*
.subcategory-pill:hover .subcategory-count {
background: rgba(255, 255, 255, 0.2);
color: #fff;
}*/

/* Blocks placed between description and products: tighter spacing */
.subcategory-nav,
.brands-strip {
  margin-bottom: 10px;
}

/* Both rows always scroll horizontally (carousel on desktop, swipe on mobile) */
.subcategory-grid,
.brands-strip .brand-grid {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.subcategory-grid::-webkit-scrollbar,
.brands-strip .brand-grid::-webkit-scrollbar {
  display: none;
}

.subcategory-pill,
.brands-strip .brand-item {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Edge fade on scrollable rows: hints that more items are reachable by swiping */
.scroll-fade-right {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 48px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 48px), transparent 100%);
}

.scroll-fade-left {
  -webkit-mask-image: linear-gradient(to left, #000 0, #000 calc(100% - 48px), transparent 100%);
  mask-image: linear-gradient(to left, #000 0, #000 calc(100% - 48px), transparent 100%);
}

.scroll-fade-left.scroll-fade-right {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
}

/* ── Desktop carousel wrapper ── */
.carousel-wrap {
  position: relative;
}

.carousel-btn {
  display: none;
}

@media (min-width: 768px) {
  .carousel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: opacity 0.2s, box-shadow 0.2s;
    padding: 0;
    line-height: 1;
    font-size: 18px;
    color: #002b58;
  }

  .carousel-btn:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  }

  .carousel-btn:disabled {
    opacity: 0.25;
    cursor: default;
  }

  .carousel-btn.carousel-prev {
    left: -18px;
  }

  .carousel-btn.carousel-next {
    right: -18px;
  }

  html[dir='rtl'] .carousel-btn.carousel-prev { left: auto; right: -18px; }
  html[dir='rtl'] .carousel-btn.carousel-next { right: auto; left: -18px; }
}

.compact-header {
  font-size: 16px;
  margin: 18px 0 8px 0;
}

.brands-strip .brand-item {
  min-width: 80px;
  min-height: 48px;
  padding: 8px 12px;
}

.brands-strip .brand-image {
  max-width: 90px;
  max-height: 45px;
}

/* Articles Grid Styles */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.article-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  border-color: #ddd;
}

.article-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f5f5f5;
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.article-card:hover .article-image img {
  transform: scale(1.05);
}

.article-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.4;
}

.article-title a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s ease;
}

.article-title a:hover {
  color: #D10024;
}

.article-excerpt {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 15px 0;
  flex: 1;
}

.read-more {
  color: #D10024;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s ease;
  display: inline-block;
}

.read-more:hover {
  color: #a00;
  transform: translateX(5px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 20px;
}

/* ===== Product card (redesigned) ===== */
article {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  height: 100%;
  overflow: hidden;
}

article:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(0, 43, 88, 0.12);
  border-color: #dfe6ee;
}

.product-image-wrapper {
  position: relative;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #f7f8fa;
}

.product-image-wrapper .product-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.product-image {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform 0.3s ease;
}

article:hover .product-image {
  transform: scale(1.05);
}

/* Card body below the image */
.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
}

h3.truncate {
  font-size: 14px;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 0 0 10px 0;
  font-weight: 500;
}

h3.truncate a {
  color: #1a2733;
  text-decoration: none;
  transition: color 0.2s ease;
}

h3.truncate a:hover {
  color: #002b58;
  text-decoration: none;
}

.price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-family: inherit;
  color: #002b58;
}

.price .currency-symbol {
  font-size: 13px;
  margin-inline-start: 2px;
  font-weight: 600;
}

.price .integer {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
}

.price .decimal {
  font-size: 11px;
  font-weight: 600;
}

.old-price {
  font-size: 13px;
  color: #9aa4ae;
  text-decoration: line-through;
  font-weight: 500;
}

.add-to-cart-btn-icon {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  background-color: #002b58;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
  z-index: 3;
}

.add-to-cart-btn-icon svg {
  width: 18px;
  height: 18px;
}

.add-to-cart-btn-icon:hover {
  background-color: #d10024;
  color: #fff;
  transform: translateY(-1px);
}

/* Badges overlaid on the image */
.product-badges {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  z-index: 2;
}

.badge-discount {
  background: #d10024;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  line-height: 1;
}

.badge-destock {
  background: #ff7a00;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
  line-height: 1;
}

.badge-oos {
  background: rgba(15, 17, 17, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
  line-height: 1;
}

/* Section Headers (Amazon Slider Style) */
.section-header {
  font-size: 21px;
  line-height: 28px;
  font-weight: 700;
  color: #0F1111;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 40px 0 15px 0;
  clear: both;
  text-decoration: none;
  padding: 0;
  border: none;
  letter-spacing: normal;
}

.section-header a {
  color: #007185;
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
}

.section-header a:hover {
  color: #C7511F;
  text-decoration: underline;
}

/* Product Flags */
.product-flags {
  list-style: none;
  padding: 0;
  margin: 0;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.product-flag {
  background: #CC0C39;
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 2px;
  margin-bottom: 4px;
  display: inline-block;
}

/* Horizontal Slider for Mobile */
@media (max-width: 768px) {
  /* Product grid: 2 columns on phones */
  .grid.product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-image-wrapper {
    height: 150px;
    padding: 10px;
  }

  .card-body {
    padding: 10px 12px 12px;
  }

  h3.truncate {
    font-size: 13px;
  }

  .price .integer {
    font-size: 19px;
  }

  .add-to-cart-btn-icon {
    padding: 9px 10px;
    font-size: 12px;
  }

  .grid.slider-mobile {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    padding-left: 5px;
    padding-right: 5px;
    scrollbar-width: none; /* Firefox */
    margin-left: -5px;
    margin-right: -5px;
  }

  .grid.slider-mobile::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
  }

  .grid.slider-mobile article {
    flex: 0 0 calc(50% - 15px);
    scroll-snap-align: start;
    min-width: 160px;
  }

  .container {
    padding: 0 10px;
  }

  .section-header {
    font-size: 18px;
    margin: 25px 0 12px 0;
  }

  .compact-header {
    font-size: 15px;
    margin: 15px 0 8px 0;
  }

  /* Subcategory pills & brands: small padding on mobile */
  .subcategory-grid,
  .brands-strip .brand-grid {
    padding-bottom: 8px;
  }

  /* Sort toolbar: scrollable row instead of wrapping */
  .sort-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }

  .sort-toolbar::-webkit-scrollbar {
    display: none;
  }
}

.view-all-link {
  text-align: center;
  margin-top: 30px;
  margin-bottom: 10px;
  clear: both;
  width: 100%;
  display: block;
}

.view-all-link a {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px;
  background-color: #002b58;
  color: #fff;
  border-radius: 5px;
  display: inline-block;
  text-decoration: none;
}

/* All-products divider */
.all-products-divider {
  display: flex;
  align-items: center;
  margin: 50px 0 0 0;
  gap: 16px;
}
.all-products-divider::before,
.all-products-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, #e0e0e0, #002b58, #e0e0e0);
  border-radius: 2px;
}
.all-products-divider span {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #002b58;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Sort toolbar */
.sort-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0 0;
}
.sort-label {
  font-size: 13px;
  color: #555;
  font-weight: 600;
  margin-right: 4px;
}
.sort-select {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 34px 8px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background-color: #fff;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
html[dir='rtl'] .sort-select {
  padding: 8px 14px 8px 34px;
  background-position: left 12px center;
}
.sort-select:hover {
  border-color: #002b58;
  color: #002b58;
}
.sort-select:focus {
  outline: none;
  border-color: #002b58;
}

.product-count {
  font-size: 13px;
  color: #777;
  font-weight: 500;
  white-space: nowrap;
  margin-inline-start: auto;
}

/* ===== Shop layout: filter sidebar + product grid ===== */
.shop-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-top: 8px;
}

.shop-main {
  flex: 1 1 auto;
  min-width: 0;
}

/* Filter panel — sidebar on desktop, bottom-sheet drawer on mobile */
.filter-panel {
  flex: 0 0 240px;
  width: 240px;
  padding: 18px;
  box-sizing: border-box;
  position: sticky;
  top: 20px;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
}

.filter-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.filter-panel__title {
  font-size: 16px;
  font-weight: 700;
  color: #0F1111;
  margin: 0;
}

.filter-panel__close {
  display: none;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: #555;
  padding: 0 4px;
}

.filter-reset {
  background: none;
  border: none;
  color: #007185;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.filter-reset:hover { color: #C7511F; text-decoration: underline; }

.filter-group {
  border-top: 1px solid #f0f0f0;
  padding: 14px 0;
}
.filter-group:first-of-type { border-top: none; padding-top: 8px; }
.filter-group:last-child { padding-bottom: 0; }

.filter-group__title {
  font-size: 14px;
  font-weight: 600;
  color: #0F1111;
  margin: 0 0 10px 0;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}
.filter-option:last-child { margin-bottom: 0; }
.filter-option input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #002b58;
  flex: 0 0 auto;
}
.filter-option .filter-count {
  color: #999;
  font-size: 12px;
  margin-inline-start: auto;
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.price-inputs input {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}
.price-inputs span { color: #999; }

/* Controls bar: filter toggle + sort + count */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}
.controls-bar .sort-toolbar {
  margin: 0;
  flex: 1 1 auto;
}

.filter-toggle {
  display: none; /* desktop: hidden (sidebar always visible) */
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #002b58;
  border-radius: 20px;
  background: #fff;
  color: #002b58;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.filter-toggle .filter-badge {
  display: none;
  background: #002b58;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 600;
}

/* Mobile "apply" bar inside the drawer */
.filter-panel__apply { display: none; }

/* No-results message */
.no-results {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: #777;
  font-size: 15px;
}
.no-results.show { display: block; }

.product-grid article.is-hidden { display: none !important; }

/* Backdrop behind the mobile drawer */
.filter-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
}
.filter-backdrop.show { display: block; }

/* ── Tablet / mobile: sidebar becomes a bottom-sheet drawer ── */
@media (max-width: 991px) {
  .shop-layout { display: block; }

  .filter-toggle { display: inline-flex; }

  /* Keep "Filtres" and the sort control on a single row */
  .controls-bar {
    flex-wrap: nowrap;
    gap: 10px;
  }
  .controls-bar .filter-toggle { flex: 0 0 auto; }
  .controls-bar .sort-toolbar {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    overflow: visible;
  }
  .controls-bar .sort-label { display: none; }
  .controls-bar .product-count { display: none; }
  .controls-bar .sort-select {
    width: auto;
    max-width: 100%;
  }

  .filter-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: none;
    border-radius: 16px 16px 0 0;
    transform: translateY(105%);
    transition: transform 0.28s ease;
    z-index: 1001;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.18);
    padding-bottom: 0;
  }
  .filter-panel.open { transform: translateY(0); }

  .filter-panel__close { display: block; }

  .filter-panel__apply {
    display: block;
    position: sticky;
    bottom: 0;
    margin: 12px -18px 0;
    padding: 12px 18px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #eee;
  }
  .filter-panel__apply button {
    width: 100%;
    padding: 13px;
    background: #002b58;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }
}

/* Category SEO description: the full text stays in the DOM for
crawlers, but it is clamped so the product grid stays high on the
page. On a phone an unclamped 300-char blurb costs ~7 lines and
pushes the first product below the fold. */
.cat-desc { position: relative; }
.cat-desc__text {
  color: #565959;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.cat-desc.is-open .cat-desc__text {
  -webkit-line-clamp: unset;
  overflow: visible;
}
.cat-desc__toggle {
  display: none;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: #007185;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.cat-desc__toggle:hover { text-decoration: underline; }
.cat-desc.is-clamped .cat-desc__toggle { display: inline-block; }
@media (max-width: 991px) {
  .cat-desc__text { font-size: 13px; -webkit-line-clamp: 2; }
}
/* No JS: never leave the text unreachable */
.no-js .cat-desc__text { -webkit-line-clamp: unset; overflow: visible; }
