/* ═══════════════════════════════════════════════════════
   AnyMarket Smart Filter — Styles
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500;600;700&display=swap');

:root {
  --amf-bg: #FFFFFF;
  --amf-bg-hover: #FAF8F5;
  --amf-border: #EDE8E1;
  --amf-dark: #1C1A17;
  --amf-body: #3D3A36;
  --amf-muted: #A99E91;
  --amf-gold: #C89B5E;
  --amf-gold-light: rgba(200,155,94,0.10);
  --amf-gold-medium: rgba(200,155,94,0.20);
  --amf-warm: #8C7B6B;
  --amf-cream: #FAF6F0;
  --amf-sand: #E8DFD3;
  --amf-radius: 12px;
  --amf-radius-sm: 8px;
  --amf-radius-pill: 50px;
  --amf-font: 'Outfit', -apple-system, sans-serif;
  --amf-transition: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Container ─── */
.amf-container {
  font-family: var(--amf-font);
  background: var(--amf-bg);
  border-radius: var(--amf-radius);
  border: 1px solid var(--amf-border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ─── Header ─── */
.amf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--amf-border);
  background: var(--amf-cream);
}

.amf-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.amf-icon {
  width: 18px;
  height: 18px;
  color: var(--amf-gold);
}

.amf-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--amf-dark);
  letter-spacing: 0.02em;
}

.amf-clear-all {
  background: none;
  border: none;
  font-family: var(--amf-font);
  font-size: 12px;
  color: var(--amf-gold);
  cursor: pointer;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--amf-radius-pill);
  transition: all 0.2s;
}

.amf-clear-all:hover {
  background: var(--amf-gold-light);
}

.amf-close-mobile {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--amf-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.amf-close-mobile:hover {
  color: var(--amf-dark);
  background: var(--amf-bg-hover);
}

/* ─── Active Filter Pills ─── */
.amf-active-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--amf-border);
  background: var(--amf-cream);
}

.amf-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  background: var(--amf-gold-light);
  border: 1px solid var(--amf-gold-medium);
  border-radius: var(--amf-radius-pill);
  font-size: 11px;
  font-weight: 500;
  color: var(--amf-dark);
  animation: amf-pill-in 0.3s var(--amf-transition);
}

@keyframes amf-pill-in {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.amf-pill-remove {
  background: none;
  border: none;
  font-size: 10px;
  color: var(--amf-warm);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.amf-pill-remove:hover {
  color: var(--amf-dark);
  background: var(--amf-gold-medium);
}

/* ─── Section (Collapsible) ─── */
.amf-section {
  border-bottom: 1px solid var(--amf-border);
}

.amf-section:last-child {
  border-bottom: none;
}

.amf-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--amf-font);
  transition: background 0.2s;
}

.amf-section-toggle:hover {
  background: var(--amf-bg-hover);
}

.amf-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--amf-dark);
  letter-spacing: 0.02em;
}

.amf-section-count {
  background: var(--amf-gold);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 8px;
  min-width: 18px;
  text-align: center;
}

.amf-chevron {
  width: 16px;
  height: 16px;
  color: var(--amf-muted);
  transition: transform 0.3s var(--amf-transition);
  flex-shrink: 0;
}

.amf-section.amf-open .amf-chevron {
  transform: rotate(180deg);
}

.amf-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--amf-transition), padding 0.3s;
  padding: 0 20px;
}

.amf-section.amf-open .amf-section-body {
  max-height: 800px;
  padding: 0 20px 16px;
}

/* ─── Categories ─── */
.amf-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.amf-cat-group {
  border-radius: var(--amf-radius-sm);
  overflow: hidden;
}

.amf-cat-parent,
.amf-cat-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  text-decoration: none;
  border-radius: var(--amf-radius-sm);
  transition: all 0.2s;
}

.amf-cat-parent {
  font-size: 13px;
  font-weight: 500;
  color: var(--amf-dark);
}

.amf-cat-parent:hover {
  background: var(--amf-bg-hover);
  color: var(--amf-gold);
}

.amf-cat-parent.active {
  background: var(--amf-gold-light);
  color: var(--amf-gold);
  font-weight: 600;
}

.amf-cat-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--amf-transition);
  padding-left: 12px;
  border-left: 2px solid var(--amf-border);
  margin-left: 14px;
}

.amf-cat-expanded .amf-cat-children {
  max-height: 400px;
}

.amf-cat-child {
  font-size: 12px;
  font-weight: 400;
  color: var(--amf-body);
  padding: 8px 12px;
}

.amf-cat-child:hover {
  background: var(--amf-bg-hover);
  color: var(--amf-gold);
}

.amf-cat-child.active {
  color: var(--amf-gold);
  font-weight: 600;
  background: var(--amf-gold-light);
}

.amf-cat-count {
  font-size: 11px;
  color: var(--amf-muted);
  font-weight: 400;
  background: var(--amf-bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 28px;
  text-align: center;
}

/* ─── Color Swatches ─── */
.amf-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.amf-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--amf-radius-sm);
  transition: all 0.2s;
  min-width: 44px;
}

.amf-swatch:hover {
  background: var(--amf-bg-hover);
  transform: translateY(-2px);
}

.amf-swatch-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.25s var(--amf-transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: relative;
}

.amf-swatch-light .amf-swatch-color {
  border-color: var(--amf-border);
}

.amf-swatch.active .amf-swatch-color {
  border-color: var(--amf-gold);
  box-shadow: 0 0 0 3px var(--amf-gold-light), 0 2px 6px rgba(0,0,0,0.12);
  transform: scale(1.1);
}

.amf-swatch.active .amf-swatch-color::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.amf-swatch.active.amf-swatch-light .amf-swatch-color::after {
  color: var(--amf-dark);
  text-shadow: none;
}

.amf-swatch-label {
  font-size: 10px;
  color: var(--amf-muted);
  font-weight: 400;
  white-space: nowrap;
  transition: color 0.2s;
}

.amf-swatch.active .amf-swatch-label {
  color: var(--amf-gold);
  font-weight: 600;
}

/* ─── Size Buttons ─── */
.amf-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.amf-size-btn {
  padding: 8px 14px;
  background: var(--amf-bg-hover);
  border: 1px solid var(--amf-border);
  border-radius: var(--amf-radius-sm);
  font-family: var(--amf-font);
  font-size: 12px;
  font-weight: 500;
  color: var(--amf-body);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 40px;
  text-align: center;
}

.amf-size-btn:hover {
  border-color: var(--amf-gold);
  color: var(--amf-gold);
  background: var(--amf-gold-light);
}

.amf-size-btn.active {
  background: var(--amf-gold);
  border-color: var(--amf-gold);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(200,155,94,0.3);
}

/* ─── Chips (Brand, Pattern, etc) ─── */
.amf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.amf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--amf-bg-hover);
  border: 1px solid var(--amf-border);
  border-radius: var(--amf-radius-pill);
  font-family: var(--amf-font);
  font-size: 12px;
  font-weight: 400;
  color: var(--amf-body);
  cursor: pointer;
  transition: all 0.2s;
}

.amf-chip:hover {
  border-color: var(--amf-gold);
  color: var(--amf-gold);
  background: var(--amf-gold-light);
}

.amf-chip.active {
  background: var(--amf-gold);
  border-color: var(--amf-gold);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(200,155,94,0.25);
}

.amf-chip-count {
  font-size: 10px;
  opacity: 0.6;
  font-weight: 400;
}

.amf-chip.active .amf-chip-count {
  opacity: 0.8;
}

/* ─── Show More ─── */
.amf-hidden-term {
  display: none !important;
}

.amf-show-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: none;
  border: 1px dashed var(--amf-border);
  border-radius: var(--amf-radius-pill);
  font-family: var(--amf-font);
  font-size: 11px;
  font-weight: 500;
  color: var(--amf-gold);
  cursor: pointer;
  transition: all 0.2s;
}

.amf-show-more:hover {
  border-color: var(--amf-gold);
  background: var(--amf-gold-light);
}

/* ─── Price Slider ─── */
.amf-price-slider {
  padding: 4px 0;
}

.amf-price-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.amf-price-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--amf-dark);
  background: var(--amf-bg-hover);
  padding: 6px 14px;
  border-radius: var(--amf-radius-sm);
  border: 1px solid var(--amf-border);
  min-width: 60px;
  text-align: center;
}

.amf-price-dash {
  color: var(--amf-muted);
  font-size: 14px;
}

.amf-range-wrapper {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
}

.amf-range-track {
  position: absolute;
  width: 100%;
  height: 4px;
  background: var(--amf-border);
  border-radius: 2px;
  pointer-events: none;
}

.amf-range-fill {
  position: absolute;
  height: 100%;
  background: var(--amf-gold);
  border-radius: 2px;
  transition: left 0.1s, right 0.1s;
}

.amf-range {
  position: absolute;
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
}

.amf-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--amf-gold);
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.2s, box-shadow 0.2s;
}

.amf-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(200,155,94,0.3);
}

.amf-range::-webkit-slider-thumb:active {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(200,155,94,0.4);
}

.amf-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--amf-gold);
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ─── Mobile ─── */
.amf-mobile-trigger {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  padding: 14px 28px;
  background: var(--amf-dark);
  color: white;
  border: none;
  border-radius: var(--amf-radius-pill);
  font-family: var(--amf-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  align-items: center;
  gap: 10px;
  transition: all 0.3s;
  letter-spacing: 0.02em;
}

.amf-mobile-trigger:hover {
  background: var(--amf-gold);
  color: var(--amf-dark);
  transform: translateX(-50%) scale(1.05);
}

.amf-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,26,23,0.5);
  z-index: 99998;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s;
}

.amf-mobile-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 991px) {
  .amf-mobile-trigger {
    display: flex;
  }

  .amf-close-mobile {
    display: block;
  }

  .amf-container {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 340px;
    max-width: 85vw;
    z-index: 99999;
    border-radius: 0;
    border: none;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.4s var(--amf-transition);
    box-shadow: 8px 0 40px rgba(0,0,0,0.15);
    -webkit-overflow-scrolling: touch;
  }

  .amf-container.amf-mobile-open {
    transform: translateX(0);
  }
}

/* ─── Scrollbar ─── */
.amf-container::-webkit-scrollbar {
  width: 4px;
}

.amf-container::-webkit-scrollbar-thumb {
  background: var(--amf-sand);
  border-radius: 2px;
}

.amf-container::-webkit-scrollbar-track {
  background: transparent;
}

/* ─── Animations ─── */
@keyframes amf-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.amf-section {
  animation: amf-fade-in 0.4s ease both;
}

.amf-section:nth-child(2) { animation-delay: 0.05s; }
.amf-section:nth-child(3) { animation-delay: 0.1s; }
.amf-section:nth-child(4) { animation-delay: 0.15s; }
.amf-section:nth-child(5) { animation-delay: 0.2s; }
.amf-section:nth-child(6) { animation-delay: 0.25s; }
.amf-section:nth-child(7) { animation-delay: 0.3s; }
.amf-section:nth-child(8) { animation-delay: 0.35s; }
