/* =========================================================
   Product Filters (Desktop + Mobile Drawer)
   Light Only + FIX:
   - Desktop: f-actions selalu tampil (static bottom)
   - Mobile: konten filter dapat discroll
   ========================================================= */

/* ========== Layout wrapper (tidak mengubah grid produk) ========== */
.product-archive.with-filters .pa-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.pa-main { flex: 1; min-width: 0; }

/* =========================================================
   DESKTOP PANEL
   ========================================================= */
.pa-filters {
  width: 300px;
  background: linear-gradient(145deg,#160b22 0%,#160b22 55%,#160b22 100%);
  border: 1px solid #5b2a78;
  padding: 18px 18px 12px; /* bottom dikurangi karena f-actions punya padding sendiri */
  border-radius: 18px;
  position: sticky;
  top: 80px;
  height: calc(100vh - 100px); /* tinggi stabil untuk inner scroll */
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04),0 4px 14px rgba(168,85,247,0.08);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: box-shadow .3s, background .4s;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* cegah double scroll, inner yang scroll */
}
.pa-filters::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  border-radius: 18px 0 0 18px;
  background: linear-gradient(180deg,#c084fc 0%,#c084fc 35%,#8b5cf6 100%);
}
.pa-filters.active { box-shadow: 0 8px 32px -4px rgba(168,85,247,0.35); }

/* Scroll area (desktop/mode shared) */
.filters-scroll {
  flex: 1;
  min-height: 0;          /* wajib agar overflow terbaca dalam flex container */
  overflow: auto;
  padding-right: 6px;
  margin-right: -6px;      /* kompensasi scrollbar */
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.filters-scroll::-webkit-scrollbar { width: 8px; }
.filters-scroll::-webkit-scrollbar-thumb {
  background: #2b143d;
  border-radius: 20px;
  border: 2px solid #c084fc;
}
.filters-scroll::-webkit-scrollbar-thumb:hover { background: #6d28d9; }

/* Heading */
.pa-filters h2 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.15;
  background: linear-gradient(90deg,#2b143d,#8b5cf6 60%,#2b143d);
  -webkit-background-clip: text;
  color: transparent;
  background-size: 200% 100%;
  animation: titleSheen 8s linear infinite;
}
@keyframes titleSheen {
  0%{background-position: 0 0}
  50%{background-position: 100% 0}
  100%{background-position: 0 0}
}

/* Form groups */
.pa-filters .f-group { margin-bottom: 18px; position: relative; }
.pa-filters label {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
  font-size: 13px;
  color: #fbf7ff;
  letter-spacing: .3px;
}

/* Inputs / selects */
.pa-filters input[type=text],
.pa-filters input[type=number],
.pa-filters select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #5b2a78;
  border-radius: 10px;
  font-size: 16px;
  min-height: 44px;
  background: #160b22;
  box-sizing: border-box;
  color: #fbf7ff;
  transition: border-color .25s, box-shadow .25s, background .25s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.pa-filters select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f0abfc' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 32px;
}
.pa-filters input[type=text]:hover,
.pa-filters input[type=number]:hover,
.pa-filters select:hover { border-color: #5b2a78; }
.pa-filters input[type=text]:focus,
.pa-filters input[type=number]:focus,
.pa-filters select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.25);
  background: #160b22;
}
.pa-filters .range { display: flex; gap: 10px; }
.pa-filters .range input { flex: 1; }
.pa-filters .hint { font-size: 11px; color: #a855f7; margin-top: 6px; }

/* Spec blocks */
.f-specs { margin-top: 4px; }
.spec-attr {
  margin: 0 0 14px;
  padding: 12px 12px 10px;
  border: 1px solid #5b2a78;
  border-radius: 14px;
  background: linear-gradient(130deg,#160b22 0%,#160b22 85%);
  position: relative;
  transition: border-color .3s, box-shadow .3s, background .4s;
}
.spec-attr.collapsed { padding-bottom: 8px; }
.spec-attr.has-selected {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139,92,246,0.15),0 2px 8px -2px rgba(139,92,246,0.35);
  background: linear-gradient(135deg,#160b22 0%,#2a143e 100%);
}
.spec-attr-title {
  font-weight: 600;
  margin: 0 0 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  color: #fbf7ff;
  user-select: none;
}
.spec-attr-title .chevron {
  font-size: 10px;
  transition: transform .25s, opacity .25s;
  opacity: .65;
}
.spec-attr.collapsed .spec-attr-title .chevron {
  transform: rotate(-90deg);
  opacity: .5;
}

/* Spec options */
.spec-attr-options { display: flex; flex-wrap: wrap; gap: 6px; }
.spec-attr-options label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  border: 1px solid #5b2a78;
  padding: 6px 9px;
  border-radius: 30px;
  cursor: pointer;
  background: #160b22;
  font-size: 12px;
  line-height: 1.1;
  transition: background .25s, border-color .25s, color .25s, box-shadow .25s;
  position: relative;
}
.spec-attr-options label:hover { background: #2a143e; border-color: #5b2a78; }
.spec-attr-options input {
  margin: 0;
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.spec-attr-options label:has(input:checked) {
  background: linear-gradient(135deg,#8b5cf6 0%,#6d28d9 100%);
  border-color: #8b5cf6;
  color: #fbf7ff;
  box-shadow: 0 2px 6px -1px rgba(139,92,246,0.55);
}
.spec-attr-options label:has(input:checked)::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 6px;
  height: 6px;
  background: #160b22;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(192,132,252,0.25),0 0 0 7px rgba(139,92,246,0.5);
  animation: pulseDot 1.9s ease-out infinite;
}
@keyframes pulseDot {
  0%{transform: scale(.8);opacity: .9}
  60%{transform: scale(1.4);opacity: .15}
  100%{transform: scale(.8);opacity: .9}
}

/* Badges */
.pa-filter-badges { margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.pa-filter-badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: linear-gradient(135deg,#211032 0%,#2a143e 100%);
  border: 1px solid #5b2a78;
  padding: 5px 10px 5px 12px;
  border-radius: 22px;
  margin: 2px 4px 0 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: #fbf7ff;
  position: relative;
  overflow: hidden;
}
.pa-filter-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,rgba(168,85,247,0),rgba(22,11,34,0.35),rgba(168,85,247,0));
  transform: translateX(-100%);
  animation: badgeSheen 6s linear infinite;
}
@keyframes badgeSheen {
  0%{transform: translateX(-100%)}
  55%{transform: translateX(120%)}
  100%{transform: translateX(120%)}
}
.pa-filter-badge a.clear {
  text-decoration: none;
  color: #a855f7;
  font-weight: 700;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  transition: background .25s, color .25s;
}
.pa-filter-badge a.clear:hover { background: #2b133b; color: #6d28d9; }
.pa-btn-filter { width: 100%;}

/* =========================================================
   ACTIONS (DESKTOP) - STATIC BOTTOM
   ========================================================= */
.f-actions {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0 4px;
  border-top: 1px solid #5b2a78;
  background: linear-gradient(180deg,rgba(168,85,247,0) 0%,#160b22 70%);
  flex-shrink: 0;
}
.f-actions button {
  background: linear-gradient(135deg,#8b5cf6 0%,#6d28d9 100%);
  color: #fbf7ff;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px -2px rgba(139,92,246,0.45);
  transition: transform .25s, box-shadow .3s;
}
.f-actions button:hover { transform: translateY(-3px); box-shadow: 0 8px 26px -4px rgba(139,92,246,0.6); }
.f-actions button:active { transform: translateY(-1px) scale(.98); box-shadow: 0 4px 14px -4px rgba(139,92,246,0.55); }
.f-actions .reset {
  font-size: 12px;
  text-decoration: none;
  color: #a855f7;
  align-self: center;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .25s, color .25s;
}
.f-actions .reset:hover { background: #321544; color: #7e22ce; text-decoration: underline; }
.pa-filters .close-drawer { display: none; }

/* Form wrapper: flex container agar inner .filters-scroll bisa scroll di desktop */
.filter-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =========================================================
   FILTER TOGGLE (MOBILE TRIGGER)
   ========================================================= */
.filter-toggle {
  display: none;
  margin: 0 0 14px;
  background: linear-gradient(135deg,#8b5cf6 0%,#6d28d9 100%);
  color: #fbf7ff;
  border: none;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  letter-spacing: .4px;
  box-shadow: 0 4px 14px -2px rgba(139,92,246,0.55);
  position: relative;
  z-index: 100;
  transition: box-shadow .3s, transform .25s;
}
.filter-toggle:hover { box-shadow: 0 8px 26px -4px rgba(139,92,246,0.6); transform: translateY(-2px); }
.filter-toggle:active { transform: translateY(0); box-shadow: 0 4px 14px -4px rgba(139,92,246,0.55); }
.filter-toggle .count-badge {
  display: inline-block;
  background: linear-gradient(135deg,#c084fc 0%,#c084fc 55%,#c084fc 100%);
  color: #fbf7ff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px 4px;
  border-radius: 30px;
  margin-left: 8px;
  box-shadow: 0 0 0 2px #c084fc,0 0 0 4px #8b5cf6;
}

/* Overlay (mobile) */
.pa-filters-overlay { display: none; }

/* =========================================================
   MOBILE DRAWER
   ========================================================= */
@media (max-width:768px){
  .product-archive.with-filters .pa-layout { flex-direction: column; gap: 12px; }
  .filter-toggle { display: inline-flex; align-items: center; gap: 6px; }

  .pa-filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,3,13,0.55);
    z-index: 998;
    opacity: 0;
    transition: opacity .35s;
    display: block;
    pointer-events: none;
    backdrop-filter: blur(2px);
  }
  .pa-filters-overlay.active { opacity: 1; pointer-events: auto; }

  .pa-filters {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    height: auto;
    width: 100%;
    border-radius: 30px 30px 0 0;
    border: 1px solid #5b2a78;
    padding: 26px 22px 0;
    z-index: 10000; /* di atas bottom-nav (9998) */
    transform: translateY(102%);
    transition: transform .55s cubic-bezier(.68,-0.35,.25,1);
    box-shadow: 0 -4px 40px -6px rgba(168,85,247,0.45);
    overflow: hidden; /* outer hidden, inner scroll */
  }
  .pa-filters.active { transform: translateY(0); }
  body.filter-open { overflow: hidden; touch-action: none; }

  .filters-scroll {
    flex: 1;
    overflow: auto;
    padding: 0 0 120px; /* ruang di atas bar actions */
    margin: 0;
    -webkit-overflow-scrolling: touch;
  }

  .pa-filters h2 { font-size: 19px; margin-bottom: 10px; }

  .pa-filters .close-drawer {
    display: block;
    position: absolute;
    right: 14px; top: 12px;
    background: linear-gradient(135deg,#9333ea 0%,#7e22ce 100%);
    color: #fbf7ff;
    padding: 7px 14px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px -2px rgba(168,85,247,0.55);
    transition: transform .25s, box-shadow .3s;
    z-index: 99;
  }
  .pa-filters .close-drawer:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -4px rgba(168,85,247,0.6); }

  .spec-attr { border-radius: 18px; }
  .spec-attr-options label { font-size: 11px; padding: 5px 9px; }

  /* Actions fixed di viewport bawah */
  .f-actions {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    border-top: 1px solid #5b2a78;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    background: rgba(22,11,34,0.918);
    backdrop-filter: blur(6px);
    box-shadow: 0 -4px 22px -6px rgba(168,85,247,0.25);
    justify-content: space-between;
    z-index: 10001; /* di atas pa-filters (10000) dan bottom-nav (9998) */
  }

  /* Sembunyikan bottom-nav saat filter drawer terbuka */
  body.filter-open .bottom-nav {
    display: none !important;
  }
  .f-actions button {
    flex: 1 1 auto;
    justify-content: center;
    padding: 14px 14px;
    font-size: 15px;
    border-radius: 14px;
  }
  .f-actions .reset {
    order: -1;
    font-size: 12px;
    padding: 2px 8px;
  }
}

/* Scrollbar (outer panel desktop only kept for compatibility) */
.pa-filters::-webkit-scrollbar { width: 0; } /* disembunyikan karena inner yang scroll */

/* Utilities */
.hidden { display: none !important; }
.gradient-text {
  background: linear-gradient(90deg,#8b5cf6,#6d28d9,#8b5cf6);
  -webkit-background-clip: text;
  color: transparent;
  animation: titleSheen 10s linear infinite;
}
.glow-focus:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.4) !important;
  border-color: #8b5cf6 !important;
}

/* Simple fade (opsional) */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}