﻿/* Product List Filter FAB + Modal
------------------------------------------------------------- */
.product-list-filter-fab {
  --plf-fab-gap: 24px;
  --plf-fab-bottom-offset: 0px;
  position: fixed;
  right: 20px;
  /* gap + JS offset (mobile-menu / browser chrome) + iOS home indicator */
  bottom: calc(var(--plf-fab-gap) + var(--plf-fab-bottom-offset) + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: clamp(48px, 12vw, 56px);
  height: clamp(48px, 12vw, 56px);
  padding: 0 1.2rem;
  border: 0;
  border-radius: 999px;
  background: #333;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.product-list-filter-fab:hover,
.product-list-filter-fab:focus-visible {
  background: #111;
  outline: none;
}

.product-list-filter-fab.is-active {
  background: #d95f84;
}

.product-list-filter-fab__icon {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  background: center / contain no-repeat
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>");
}

.product-list-filter-fab__label {
  line-height: 1;
}

@media screen and (max-width: 768px) {
  .product-list-filter-fab {
    --plf-fab-gap: 20px;
    right: 3%;
    padding: 0 1.4rem;
  }
}

/* Keep clear of .pageTop (bottom: 120px) — FAB sits above .mobile-menu via JS offset */

.product-list-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
}

.product-list-filter-modal.is-open {
  display: flex;
}

.product-list-filter-modal__bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.product-list-filter-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 40rem);
  max-height: calc(100vh - 3.2rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1.2rem;
  box-shadow: 0 1.2rem 3.2rem rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.product-list-filter-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.6rem 1rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.product-list-filter-modal__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #333;
}

.product-list-filter-modal__close {
  border: 0;
  background: transparent;
  color: #666;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
}

.product-list-filter-modal__close:hover,
.product-list-filter-modal__close:focus-visible {
  color: #111;
  outline: none;
}

.product-list-filter-modal__body {
  padding: 1.2rem 1.6rem;
  overflow: visible;
}

.product-list-filter-modal__field {
  margin: 0 0 1.2rem;
}

.product-list-filter-modal__field:last-child {
  margin-bottom: 0;
}

.product-list-filter-modal__label {
  display: block;
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #555;
}

.product-list-filter-modal__select {
  width: 100%;
  height: 4rem;
  padding: 0 1.2rem;
  border: 1px solid #ddd;
  border-radius: 0.8rem;
  background: #fff;
  color: #333;
  font-size: 1.4rem;
  appearance: auto;
}

.product-list-filter-modal__select:focus {
  border-color: #d95f84;
  outline: none;
}

/* Color swatches — 6 per row × up to 3 rows */
.product-list-filter-colors {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
}

.product-list-filter-color {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 3.6rem;
  margin: 0 auto;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  background-clip: padding-box;
}

.product-list-filter-color:focus-visible {
  outline: 2px solid #d95f84;
  outline-offset: 2px;
}

.product-list-filter-color.is-selected {
  border-color: #d95f84;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    0 0 0 2px rgba(217, 95, 132, 0.25);
}

.product-list-filter-color.is-selected::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.product-list-filter-color--black { background: #222; }
.product-list-filter-color--white { background: #fff; }
.product-list-filter-color--gray { background: #9e9e9e; }
.product-list-filter-color--ivory { background: #f5f0e6; }
.product-list-filter-color--nude { background: #e8d5c4; }
.product-list-filter-color--yellow { background: #f5d76e; }
.product-list-filter-color--pink { background: #f4a6c4; }
.product-list-filter-color--purple { background: #9b7bb8; }
.product-list-filter-color--brown { background: #8b5a2b; }
.product-list-filter-color--red { background: #e74c3c; }
.product-list-filter-color--winered { background: #8b1e3f; }
.product-list-filter-color--orange { background: #f39c12; }
.product-list-filter-color--blue { background: #5dade2; }
.product-list-filter-color--navy { background: #2c3e6b; }
.product-list-filter-color--sax { background: #7eb6d9; }
.product-list-filter-color--green { background: #6ab04c; }
.product-list-filter-color--mint { background: #a8e6cf; }

.product-list-filter-color--white.is-selected::after,
.product-list-filter-color--ivory.is-selected::after,
.product-list-filter-color--yellow.is-selected::after,
.product-list-filter-color--mint.is-selected::after {
  background: #d95f84;
}

.product-list-filter-modal__footer {
  display: flex;
  gap: 0.8rem;
  padding: 1rem 1.6rem 1.4rem;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

.product-list-filter-modal__btn {
  flex: 1;
  height: 4.4rem;
  border-radius: 999px;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
}

.product-list-filter-modal__btn--clear {
  border: 1px solid #ccc;
  background: #fff;
  color: #555;
}

.product-list-filter-modal__btn--apply {
  border: 0;
  background: linear-gradient(135deg, #d95f84 0%, #ef7ca1 100%);
  color: #fff;
}

.product-list-filter-modal__btn:hover,
.product-list-filter-modal__btn:focus-visible {
  opacity: 0.92;
  outline: none;
}

body.product-list-filter-open {
  overflow: hidden;
}

/* Fallback: if viewport is very short, allow body scroll rather than clipping */
@media screen and (max-height: 560px) {
  .product-list-filter-modal__dialog {
    max-height: calc(100vh - 1.6rem);
  }

  .product-list-filter-modal__body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .product-list-filter-colors {
    gap: 0.4rem;
  }

  .product-list-filter-color {
    max-width: 3rem;
  }

  .product-list-filter-modal__field {
    margin-bottom: 0.8rem;
  }
}

@media screen and (min-width: 768px) {
  .product-list-filter-modal__dialog {
    width: 42rem;
  }
}
