/* ═══════════════════════════════════════════════════════════════
   COLLECTION FILTER DRAWER
   Mobile-first, RTL-aware, smooth animations
   ═══════════════════════════════════════════════════════════════ */

/* ── Open Button ── */
.cf-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1.5px solid #222;
  border-radius: 50px;
  background: #fff;
  color: #222;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.cf-open-btn:active {
  transform: scale(0.96);
  background: #f5f5f5;
}

.cf-open-btn svg {
  flex-shrink: 0;
}

.cf-active-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 50px;
  background: #222;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

/* ── Overlay ── */
.cf-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.cf-overlay-visible {
  opacity: 1;
  visibility: visible;
}

/* ── Drawer ── */
.cf-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(340px, 85vw);
  height: 100%;
  background: #fff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}

/* LTR: open from left */
.cf-drawer[dir="ltr"] {
  right: auto;
  left: 0;
  transform: translateX(-100%);
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
}

.cf-drawer-open {
  transform: translateX(0) !important;
}

/* ── Drawer Header ── */
.cf-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.cf-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.01em;
}

.cf-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  color: #555;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.cf-drawer-close:active {
  background: #eee;
  transform: scale(0.9);
}

/* ── Drawer Body (scrollable) ── */
.cf-drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 10px;
}

/* ── Section ── */
.cf-section {
  border-bottom: 1px solid #f0f0f0;
}

.cf-section-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  font-family: inherit;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}

.cf-section-toggle span:first-child {
  flex: 1;
  text-align: start;
}

.cf-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
  color: #999;
}

.cf-section-collapsed .cf-chevron {
  transform: rotate(-90deg);
}

[dir="ltr"] .cf-section-collapsed .cf-chevron {
  transform: rotate(-90deg);
}

.cf-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 20px;
}

.cf-section-content.cf-section-open {
  max-height: 500px;
  padding: 0 20px 16px;
}

/* ── Badge ── */
.cf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 50px;
  background: #222;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

/* ── Sort Radio Items ── */
.cf-radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  font-size: 13.5px;
  color: #333;
  -webkit-tap-highlight-color: transparent;
}

.cf-radio-item input[type="radio"] {
  display: none;
}

.cf-radio-circle {
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s ease;
}

.cf-radio-item input[type="radio"]:checked ~ .cf-radio-circle {
  border-color: #222;
}

.cf-radio-item input[type="radio"]:checked ~ .cf-radio-circle::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #222;
}

/* ── Size Grid ── */
.cf-size-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-size-chip {
  min-width: 44px;
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cf-size-chip:active {
  transform: scale(0.95);
}

.cf-size-chip.cf-active {
  border-color: #222;
  background: #222;
  color: #fff;
}

/* ── Color Grid ── */
.cf-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cf-color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 50px;
}

.cf-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
}

.cf-color-swatch:active {
  transform: scale(0.9);
}

.cf-color-swatch.cf-color-light {
  border-color: #ddd;
}

.cf-color-swatch.cf-active {
  border-color: #222;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #222;
}

.cf-color-swatch.cf-active::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}

.cf-color-swatch.cf-color-light.cf-active::after {
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-color: rgba(0,0,0,0.05);
}

.cf-color-label {
  font-size: 10px;
  color: #666;
  text-align: center;
  line-height: 1.2;
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Price Range Slider ── */
.cf-price-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
  color: #222;
}

.cf-price-dash {
  color: #ccc;
  margin: 0 8px;
}

.cf-price-slider {
  position: relative;
  width: 100%;
  height: 36px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.cf-slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #e8e8e8;
  border-radius: 4px;
  transform: translateY(-50%);
}

.cf-slider-range {
  position: absolute;
  top: 50%;
  height: 4px;
  background: #222;
  border-radius: 4px;
  transform: translateY(-50%);
}

.cf-slider-thumb {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  background: #222;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(50%, -50%);
  cursor: grab;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

[dir="ltr"] .cf-slider-thumb {
  transform: translate(-50%, -50%);
}

.cf-slider-thumb:active {
  cursor: grabbing;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.cf-slider-thumb:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34,34,34,0.2), 0 2px 6px rgba(0,0,0,0.2);
}

/* ── Footer ── */
.cf-drawer-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}

.cf-btn-clear {
  flex: 0 0 auto;
  padding: 12px 18px;
  border: 1.5px solid #ddd;
  border-radius: 50px;
  background: #fff;
  color: #555;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.cf-btn-clear:active {
  background: #f5f5f5;
  transform: scale(0.97);
}

.cf-btn-apply {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 50px;
  background: #222;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.cf-btn-apply:active {
  background: #444;
  transform: scale(0.97);
}

/* ── No Results ── */
.cf-no-results {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 15px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .cf-drawer {
    width: 380px;
  }

  .cf-open-btn {
    font-size: 14px;
    padding: 8px 20px;
  }

  .cf-size-chip {
    min-width: 48px;
    height: 40px;
    font-size: 14px;
  }

  .cf-color-swatch {
    width: 40px;
    height: 40px;
  }

  .cf-color-item {
    width: 54px;
  }

  .cf-slider-thumb {
    width: 26px;
    height: 26px;
  }
}