/* =========================================================
   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,#ffffff 0%,#f8fafc 55%,#f1f5f9 100%);
  border:1px solid #e2e8f0;
  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,.04),0 4px 14px rgba(15,23,42,.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,#f59e0b 0%,#ffb53a 35%,#1d6ce0 100%);
}
.pa-filters.active { box-shadow:0 8px 32px -4px rgba(15,23,42,.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:#cbd5e1;
  border-radius:20px;
  border:2px solid #f1f5f9;
}
.filters-scroll::-webkit-scrollbar-thumb:hover { background:#94a3b8; }

/* 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,#0f172a,#1d6ce0 60%,#0f172a);
  -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:#0f172a;
  letter-spacing:.3px;
}

/* Inputs / selects */
.pa-filters input[type=text],
.pa-filters input[type=number],
.pa-filters select {
  width:100%;
  padding:8px 10px;
  border:1px solid #cbd5e1;
  border-radius:10px;
  font-size:13px;
  background:#ffffff;
  box-sizing:border-box;
  color:#0f172a;
  transition:border-color .25s, box-shadow .25s, background .25s;
}
.pa-filters input[type=text]:hover,
.pa-filters input[type=number]:hover,
.pa-filters select:hover { border-color:#94b5ec; }
.pa-filters input[type=text]:focus,
.pa-filters input[type=number]:focus,
.pa-filters select:focus {
  outline:none;
  border-color:#1d6ce0;
  box-shadow:0 0 0 3px rgba(29,108,224,.25);
  background:#f8fbff;
}
.pa-filters .range { display:flex; gap:10px; }
.pa-filters .range input { flex:1; }
.pa-filters .hint { font-size:11px; color:#64748b; margin-top:6px; }

/* Spec blocks */
.f-specs { margin-top:4px; }
.spec-attr {
  margin:0 0 14px;
  padding:12px 12px 10px;
  border:1px solid #e2e8f0;
  border-radius:14px;
  background:linear-gradient(130deg,#ffffff 0%,#f7faff 85%);
  position:relative;
  transition:border-color .3s, box-shadow .3s, background .4s;
}
.spec-attr.collapsed { padding-bottom:8px; }
.spec-attr.has-selected {
  border-color:#1d6ce0;
  box-shadow:0 0 0 2px rgba(29,108,224,.15),0 2px 8px -2px rgba(29,108,224,.35);
  background:linear-gradient(135deg,#ffffff 0%,#e9f2ff 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:#0f172a;
  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 #d4dde7;
  padding:6px 9px;
  border-radius:30px;
  cursor:pointer;
  background:#f3f6fa;
  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:#e8f1ff; border-color:#b1cff3; }
.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,#1d6ce0 0%,#155ab8 100%);
  border-color:#1d6ce0;
  color:#ffffff;
  box-shadow:0 2px 6px -1px rgba(29,108,224,.55);
}
.spec-attr-options label:has(input:checked)::after {
  content:"";
  position:absolute;
  right:6px;
  top:6px;
  width:6px;
  height:6px;
  background:#fff;
  border-radius:50%;
  box-shadow:0 0 0 4px rgba(255,255,255,.25),0 0 0 7px rgba(29,108,224,.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,#eef4ff 0%,#e0edff 100%);
  border:1px solid #b4cff3;
  padding:5px 10px 5px 12px;
  border-radius:22px;
  margin:2px 4px 0 0;
  font-size:11px;
  font-weight:500;
  line-height:1;
  color:#0f172a;
  position:relative;
  overflow:hidden;
}
.pa-filter-badge::before {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.35),rgba(255,255,255,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:#c02828;
  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:#ffeded; color:#a40000; }
.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 #e2e8f0;
  background:linear-gradient(180deg,rgba(255,255,255,0) 0%,#f1f5f9 70%);
  flex-shrink:0;
}
.f-actions button {
  background:linear-gradient(135deg,#1d6ce0 0%,#155ab8 100%);
  color:#fff;
  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(29,108,224,.45);
  transition:transform .25s, box-shadow .3s;
}
.f-actions button:hover { transform:translateY(-3px); box-shadow:0 8px 26px -4px rgba(29,108,224,.6); }
.f-actions button:active { transform:translateY(-1px) scale(.98); box-shadow:0 4px 14px -4px rgba(29,108,224,.55); }
.f-actions .reset {
  font-size:12px;
  text-decoration:none;
  color:#d92d2d;
  align-self:center;
  font-weight:600;
  padding:4px 6px;
  border-radius:8px;
  transition:background .25s, color .25s;
}
.f-actions .reset:hover { background:#ffe6e6; color:#b80000; text-decoration:underline; }
.pa-filters .close-drawer { display: none; }

/* =========================================================
   FILTER TOGGLE (MOBILE TRIGGER)
   ========================================================= */
.filter-toggle {
  display:none;
  margin:0 0 14px;
  background:linear-gradient(135deg,#1d6ce0 0%,#155ab8 100%);
  color:#fff;
  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(29,108,224,.55);
  position:relative;
  z-index:100;
  transition:box-shadow .3s, transform .25s;
}
.filter-toggle:hover { box-shadow:0 8px 26px -4px rgba(29,108,224,.6); transform:translateY(-2px); }
.filter-toggle:active { transform:translateY(0); box-shadow:0 4px 14px -4px rgba(29,108,224,.55); }
.filter-toggle .count-badge {
  display:inline-block;
  background:linear-gradient(135deg,#f59e0b 0%,#ffb43d 55%,#f59e0b 100%);
  color:#1d2b44;
  font-size:11px;
  font-weight:700;
  padding:3px 7px 4px;
  border-radius:30px;
  margin-left:8px;
  box-shadow:0 0 0 2px #ffffff,0 0 0 4px #1d6ce0;
}

/* 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(0,20,45,.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 #dbe4ef;
    padding:26px 22px 0;
    z-index:999;
    transform:translateY(102%);
    transition:transform .55s cubic-bezier(.68,-0.35,.25,1);
    box-shadow:0 -4px 40px -6px rgba(15,23,42,.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,#dc2626 0%,#b91c1c 100%);
    color:#fff;
    padding:7px 14px;
    border:none;
    border-radius:10px;
    font-size:12px;
    font-weight:600;
    cursor:pointer;
    box-shadow:0 3px 10px -2px rgba(220,38,38,.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(220,38,38,.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 #d6dee8;
    padding:14px 16px calc(16px + env(safe-area-inset-bottom));
    background:#ffffffea;
    backdrop-filter:blur(6px);
    box-shadow:0 -4px 22px -6px rgba(15,23,42,.25);
    justify-content:space-between;
    z-index:1000;
  }
  .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,#1d6ce0,#155ab8,#1d6ce0);
  -webkit-background-clip:text;
  color:transparent;
  animation:titleSheen 10s linear infinite;
}
.glow-focus:focus {
  outline:none !important;
  box-shadow:0 0 0 3px rgba(29,108,224,.4) !important;
  border-color:#1d6ce0 !important;
}

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