/* app/assets/stylesheets/filters.css */
/* Filtres façon sidebar (inspiré Sephora) : colonne de filtres fixe à
   gauche sur desktop, tiroir coulissant sur mobile. Toutes les sections
   sont dépliées par défaut. La liste de marques reste une liste
   verticale scrollable avec recherche, pour tenir à l'échelle avec
   des catalogues à 100+ marques. */

.shop-layout {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
}

/* --- Sidebar --- */

.shop-sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(201, 162, 39, 0.15);
  box-shadow: 0 4px 20px rgba(27, 22, 17, 0.05);
  padding: 8px 22px 18px;
}

.shop-sidebar-header {
  display: none;
}

.shop-sidebar-section {
  padding: 18px 0;
  border-bottom: 1px solid rgba(201, 162, 39, 0.14);
}

.shop-sidebar-section:last-of-type {
  border-bottom: none;
}

.shop-sidebar-section-title {
  font-family: "Playfair Display", serif;
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-color, #2A241E);
}

.shop-sidebar-options {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shop-sidebar-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 6px;
  font-family: "Lato", sans-serif;
  font-size: 0.86rem;
  text-align: left;
  color: var(--text-color, #2A241E);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.shop-sidebar-option:hover {
  background: var(--soft-cream, #FAF6F0);
}

.shop-sidebar-option-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid rgba(201, 162, 39, 0.4);
  background: #ffffff;
  position: relative;
}

.shop-sidebar-option.is-active {
  font-weight: 600;
  color: var(--dark-gold, #8A6D1F);
}

.shop-sidebar-option.is-active .shop-sidebar-option-check {
  background: var(--gold-accent, #C9A227);
  border-color: var(--gold-accent, #C9A227);
}

.shop-sidebar-option.is-active .shop-sidebar-option-check::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* --- Marque : recherche + liste scrollable (centaines de marques) --- */

.filter-brand-search {
  width: 100%;
  padding: 9px 12px;
  font-family: "Lato", sans-serif;
  font-size: 0.85rem;
  color: var(--text-color, #2A241E);
  background: var(--soft-cream, #FAF6F0);
  border: 1.5px solid transparent;
  border-radius: 8px;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.filter-brand-search:focus {
  outline: none;
  border-color: var(--gold-accent, #C9A227);
  background: #ffffff;
}

.filter-brand-list {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow-y: auto;
}

.filter-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 6px;
  font-family: "Lato", sans-serif;
  font-size: 0.86rem;
  text-align: left;
  color: var(--text-color, #2A241E);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.filter-brand-row:hover {
  background: var(--soft-cream, #FAF6F0);
}

.filter-brand-row-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid rgba(201, 162, 39, 0.4);
  background: #ffffff;
  position: relative;
}

.filter-brand-row.is-active {
  font-weight: 600;
  color: var(--dark-gold, #8A6D1F);
}

.filter-brand-row.is-active .filter-brand-row-check {
  background: var(--gold-accent, #C9A227);
  border-color: var(--gold-accent, #C9A227);
}

.filter-brand-row.is-active .filter-brand-row-check::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-brand-empty {
  padding: 10px 6px;
  font-size: 0.82rem;
  color: var(--text-color-light, #6B6256);
}

.shop-sidebar-footer {
  display: none;
}

.shop-sidebar-backdrop {
  display: none;
}

/* --- Zone principale : barre d'outils + résultats --- */

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

/* Cartes plus compactes à côté de la sidebar : sans description (trop
   encombrante), grille plus dense pour une répartition harmonieuse. */

.shop-main .perfumes-grid {
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 1.75rem;
}

.shop-main .perfume-image-wrapper {
  height: 180px;
}

.shop-main .perfume-content {
  padding: 1.5rem 1.1rem;
}

.shop-main .perfume-name {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.shop-main .perfume-meta {
  margin-bottom: 1rem;
}

.shop-main .perfume-price {
  font-size: 1.3rem;
}

.shop-main .perfume-description {
  display: none;
}

/* Même traitement compact sur la sous-page "parfums d'une marque", pour
   rester visuellement cohérent avec les autres pages de liste. */

.brand-page-container .perfumes-grid {
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 1.75rem;
}

.brand-page-container .perfume-image-wrapper {
  height: 180px;
}

.brand-page-container .perfume-content {
  padding: 1.5rem 1.1rem;
}

.brand-page-container .perfume-name {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.brand-page-container .perfume-meta {
  margin-bottom: 1rem;
}

.brand-page-container .perfume-price {
  font-size: 1.3rem;
}

.brand-page-container .perfume-description {
  display: none;
}

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.filter-toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: "Lato", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-color, #2A241E);
  background: #ffffff;
  border: 1.5px solid rgba(201, 162, 39, 0.35);
  border-radius: 999px;
  cursor: pointer;
}

.filter-toggle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--gold-accent, #C9A227);
  border-radius: 999px;
}

.filter-count-badge[hidden] {
  display: none;
}

.filter-sort-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 7px 14px;
  font-family: "Lato", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-color, #2A241E);
  background: var(--soft-cream, #FAF6F0);
  border: 1.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--gold-accent, #C9A227);
}

.filter-pill.is-active {
  background: linear-gradient(135deg, var(--gold-accent, #C9A227), var(--dark-gold, #8A6D1F));
  color: #ffffff;
  font-weight: 600;
}

.filter-results-count {
  font-family: "Lato", sans-serif;
  font-size: 0.82rem;
  color: var(--text-color-light, #6B6256);
  white-space: nowrap;
}

/* --- Puces de filtres actifs --- */

.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.active-filters-bar[hidden] {
  display: none;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 14px;
  font-family: "Lato", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--dark-charcoal, #1B1611);
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 999px;
  cursor: pointer;
}

.active-filter-chip-x {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-color-light, #6B6256);
}

.active-filter-clear {
  font-family: "Lato", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  color: var(--text-color-light, #6B6256);
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 4px;
}

.active-filter-clear:hover {
  color: var(--dark-charcoal, #1B1611);
}

/* --- Mobile : la sidebar devient un tiroir coulissant --- */

@media (max-width: 860px) {
  .filter-toggle-btn {
    display: inline-flex;
  }

  .shop-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    width: 86%;
    max-width: 320px;
    height: 100%;
    max-height: none;
    border-radius: 0;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.25);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  .shop-sidebar.is-open {
    transform: translateX(0);
  }

  .shop-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.15);
    flex-shrink: 0;
  }

  .shop-sidebar-header h3 {
    font-family: "Playfair Display", serif;
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-color, #2A241E);
  }

  .shop-sidebar-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-color-light, #6B6256);
    cursor: pointer;
    padding: 4px;
  }

  .shop-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 20px 18px;
  }

  .shop-sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(201, 162, 39, 0.15);
    background: var(--soft-cream, #FAF6F0);
    flex-shrink: 0;
  }

  .shop-sidebar-clear {
    font-family: "Lato", sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: underline;
    color: var(--text-color-light, #6B6256);
    background: none;
    border: none;
    cursor: pointer;
  }

  .shop-sidebar-apply {
    flex: 1;
    font-family: "Lato", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, var(--gold-accent, #C9A227), var(--dark-gold, #8A6D1F));
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    cursor: pointer;
  }

  .shop-sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(27, 22, 17, 0.45);
    z-index: 1090;
  }

  .filter-sort-pills .filter-pill:not(.is-active) {
    display: none;
  }

  .filter-results-count {
    display: none;
  }
}
