/**
 * Onsus Product Filter — Frontend Styles v1.1
 * Brand color: #EB4F08 (orange)
 */

/* =========================================================================
   0. CSS Custom Properties
   ====================================================================== */
:root {
  --opf-primary:        #EB4F08;
  --opf-primary-dark:   #c94207;
  --opf-primary-light:  rgba(235,79,8,.10);
  --opf-surface:        #ffffff;
  --opf-surface-alt:    #f8f8fb;
  --opf-border:         #e8e8f0;
  --opf-text:           #1a1a2e;
  --opf-text-muted:     #888899;
  --opf-radius:         10px;
  --opf-radius-sm:      6px;
  --opf-shadow:         0 4px 24px rgba(0,0,0,.07);
  --opf-transition:     .22s cubic-bezier(.4,0,.2,1);
  --opf-sidebar-width:  280px;
  --opf-gap:            28px;
}

/* =========================================================================
   1. Outer wrapper — two-column flex layout
   ====================================================================== */
.opf-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--opf-gap);
  width: 100%;
}

.opf-layout--left  { flex-direction: row; }
.opf-layout--right { flex-direction: row-reverse; }

/* =========================================================================
   2. Sidebar
   ====================================================================== */
.opf-sidebar {
  flex: 0 0 var(--opf-sidebar-width);
  max-width: var(--opf-sidebar-width);
  position: sticky;
  top: 90px;
}

.opf-filter-wrap {
  background: var(--opf-surface);
  border-radius: var(--opf-radius);
  box-shadow: var(--opf-shadow);
  border: 1px solid var(--opf-border);
  overflow: hidden;
}

/* =========================================================================
   3. Active filters bar
   ====================================================================== */
.opf-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--opf-primary-light);
  border-bottom: 1px solid var(--opf-border);
}

.opf-active-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--opf-primary);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.opf-clear-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--opf-primary);
  text-decoration: none;
  transition: color var(--opf-transition);
}
.opf-clear-link:hover { color: var(--opf-primary-dark); }
.opf-clear-icon { font-size: 10px; }

/* =========================================================================
   4. Filter form
   ====================================================================== */
.opf-filter-form { display: flex; flex-direction: column; }

/* =========================================================================
   5. Filter section — with breathing room between sections (item 2)
   ====================================================================== */
.opf-filter-section {
  border-bottom: 1px solid var(--opf-border);
  margin-bottom: 4px;   /* gap between sections */
}
.opf-filter-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.opf-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  background: #EB4F08;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--opf-transition);
}
.opf-section-header:hover { background: #c94207; }

.opf-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.opf-toggle-icon {
  font-size: 12px;
  color: #ffffff;
  transition: transform var(--opf-transition);
  display: inline-block;
}
/* Arrow points right when collapsed, down when open */
.opf-toggle[aria-expanded="false"] .opf-toggle-icon { transform: rotate(-90deg); }
.opf-toggle[aria-expanded="true"]  .opf-toggle-icon { transform: rotate(0deg); }

.opf-section-body {
  padding: 0 18px 16px;
  overflow: hidden;
}
.opf-section-body.is-collapsed { display: none; }

/* =========================================================================
   6. Price filter — min / max input boxes
   ====================================================================== */
.opf-price-inputs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.opf-price-input {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.opf-price-input label {
  font-size: 11px;
  font-weight: 600;
  color: var(--opf-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.opf-price-input input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--opf-border);
  border-radius: var(--opf-radius-sm);
  font-size: 14px;
  color: var(--opf-text);
  background: var(--opf-surface-alt);
  outline: none;
  transition: border-color var(--opf-transition), box-shadow var(--opf-transition);
  -moz-appearance: textfield;
}
.opf-price-input input[type="number"]::-webkit-outer-spin-button,
.opf-price-input input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.opf-price-input input[type="number"]:focus {
  border-color: var(--opf-primary);
  box-shadow: 0 0 0 3px var(--opf-primary-light);
}

.opf-price-sep {
  padding-bottom: 10px;
  color: var(--opf-text-muted);
  font-size: 16px;
  font-weight: 300;
}

.opf-price-range-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--opf-text-muted);
}

/* =========================================================================
   7. Checkbox list
   ====================================================================== */
.opf-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.opf-checklist--child {
  margin-left: 20px;
  margin-top: 4px;
  padding-top: 4px;
  border-left: 2px solid var(--opf-border);
  padding-left: 12px;
}

.opf-checklist-item { position: relative; }

.opf-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--opf-radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--opf-text);
  transition: background var(--opf-transition), color var(--opf-transition);
  user-select: none;
}
.opf-checkbox-label:hover { background: var(--opf-surface-alt); color: var(--opf-primary); }
.opf-checkbox-label.is-active { color: var(--opf-primary); font-weight: 600; }

/* Hide native checkbox */
.opf-checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom checkbox */
.opf-checkmark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--opf-border);
  border-radius: 4px;
  background: var(--opf-surface);
  position: relative;
  transition: border-color var(--opf-transition), background var(--opf-transition);
}
.opf-checkbox-label input:checked ~ .opf-checkmark {
  background: var(--opf-primary);
  border-color: var(--opf-primary);
}
.opf-checkmark::after {
  content: '';
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.opf-checkbox-label input:checked ~ .opf-checkmark::after { display: block; }

.opf-label-text { flex: 1; }

.opf-count {
  font-size: 11px;
  color: var(--opf-text-muted);
  font-weight: 400;
}

/* =========================================================================
   8. Filter button / Reset button
   ====================================================================== */
.opf-filter-actions {
  display: flex;
  gap: 8px;
  padding: 16px 18px;
  background: var(--opf-surface-alt);
  border-top: 1px solid var(--opf-border);
}

.opf-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  padding: 11px 18px;
  border: none;
  border-radius: var(--opf-radius-sm);
  background: var(--opf-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background var(--opf-transition), transform var(--opf-transition), box-shadow var(--opf-transition);
  text-decoration: none;
}
.opf-filter-btn:hover {
  background: var(--opf-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(235,79,8,.30);
  color: #fff;
}
.opf-filter-btn:active { transform: translateY(0); }

.opf-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  border: 1.5px solid var(--opf-border);
  border-radius: var(--opf-radius-sm);
  background: var(--opf-surface);
  color: var(--opf-text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--opf-transition), color var(--opf-transition);
  text-decoration: none;
  white-space: nowrap;
}
.opf-reset-btn:hover { border-color: var(--opf-primary); color: var(--opf-primary); }

/* =========================================================================
   9. Products area
   ====================================================================== */
.opf-products-area { flex: 1; min-width: 0; }

.opf-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.opf-result-count {
  font-size: 13px;
  color: var(--opf-text-muted);
  font-weight: 500;
}

.opf-active-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.opf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--opf-primary-light);
  color: var(--opf-primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(235,79,8,.25);
  transition: background var(--opf-transition), color var(--opf-transition);
}
.opf-chip:hover { background: var(--opf-primary); color: #fff; }
.opf-chip span { font-size: 10px; }

/* =========================================================================
   10. Product grid columns
   ====================================================================== */
.opf-product-grid {
  display: grid;
  gap: 24px;
}
.opf-cols-1 { grid-template-columns: repeat(1, 1fr); }
.opf-cols-2 { grid-template-columns: repeat(2, 1fr); }
.opf-cols-3 { grid-template-columns: repeat(3, 1fr); }
.opf-cols-4 { grid-template-columns: repeat(4, 1fr); }
.opf-cols-5 { grid-template-columns: repeat(5, 1fr); }
.opf-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* =========================================================================
   11. Product card
   ====================================================================== */
.opf-product-card {
  background: var(--opf-surface);
  border-radius: var(--opf-radius);
  border: 1px solid var(--opf-border);
  overflow: hidden;
  transition: box-shadow var(--opf-transition), transform var(--opf-transition);
  display: flex;
  flex-direction: column;
}
.opf-product-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,.1);
  transform: translateY(-3px);
}

.opf-product-thumb {
  position: relative;
  overflow: hidden;
  background: var(--opf-surface-alt);
  aspect-ratio: 1 / 1;
}
.opf-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
  display: block;
}
.opf-product-card:hover .opf-product-thumb img { transform: scale(1.06); }

.opf-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  z-index: 2;
}
.opf-badge--sale     { background: #EB4F08; color: #fff; }
.opf-badge--featured { background: var(--opf-primary-dark); color: #fff; }

.opf-product-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.5));
  transform: translateY(100%);
  transition: transform var(--opf-transition);
  display: flex;
  justify-content: center;
}
.opf-product-card:hover .opf-product-actions { transform: translateY(0); }

.opf-add-to-cart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--opf-radius-sm);
  background: #fff;
  color: var(--opf-text) !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background var(--opf-transition), color var(--opf-transition);
  white-space: nowrap;
}
.opf-add-to-cart:hover { background: var(--opf-primary); color: #fff !important; }

.opf-product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.opf-product-cat {
  font-size: 11px;
  color: var(--opf-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.opf-product-cat a { color: inherit; text-decoration: none; }
.opf-product-cat a:hover { text-decoration: underline; }

.opf-product-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--opf-text);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.opf-product-title a { color: inherit; text-decoration: none; }
.opf-product-title a:hover { color: var(--opf-primary); }

.opf-product-rating { display: flex; align-items: center; gap: 4px; }
.opf-product-rating .star-rating { font-size: 13px; }

.opf-product-price {
  margin-top: auto;
  font-weight: 700;
  font-size: 15px;
  color: var(--opf-text);
}
.opf-product-price .woocommerce-Price-amount { color: var(--opf-primary); }
.opf-product-price del { color: var(--opf-text-muted); font-weight: 400; font-size: 12px; margin-right: 4px; }

/* =========================================================================
   12. Pagination
   ====================================================================== */
.opf-pagination { margin-top: 36px; display: flex; justify-content: center; }
.opf-pagination .page-numbers {
  display: inline-flex;
  list-style: none;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.opf-pagination .page-numbers li a,
.opf-pagination .page-numbers li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--opf-border);
  border-radius: var(--opf-radius-sm);
  background: var(--opf-surface);
  color: var(--opf-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--opf-transition), border-color var(--opf-transition), color var(--opf-transition);
}
.opf-pagination .page-numbers li a:hover {
  background: var(--opf-primary-light);
  border-color: var(--opf-primary);
  color: var(--opf-primary);
}
.opf-pagination .page-numbers li .current {
  background: var(--opf-primary);
  border-color: var(--opf-primary);
  color: #fff;
}

/* =========================================================================
   13. No products found
   ====================================================================== */
.opf-no-products {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--opf-text-muted);
  gap: 16px;
}
.opf-no-products svg { opacity: .4; }
.opf-no-products p { font-size: 15px; margin: 0; }

/* =========================================================================
   14. Mobile toggle button — sticky so it doesn't disappear on scroll (item 3)
   ====================================================================== */
.opf-mobile-toggle-btn {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  margin-bottom: 12px;
  border: 1.5px solid var(--opf-border);
  border-radius: var(--opf-radius-sm);
  background: var(--opf-surface);
  color: var(--opf-text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--opf-transition), color var(--opf-transition),
              background var(--opf-transition), box-shadow var(--opf-transition);
}
.opf-mobile-toggle-btn:hover {
  border-color: var(--opf-primary);
  color: var(--opf-primary);
}

/* =========================================================================
   15. Responsive
   ====================================================================== */
@media (max-width: 1024px) {
  .opf-product-grid.opf-cols-4 { grid-template-columns: repeat(3, 1fr); }
  .opf-product-grid.opf-cols-5 { grid-template-columns: repeat(3, 1fr); }
  .opf-product-grid.opf-cols-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
  /* Stack sidebar above products */
  .opf-wrapper { flex-direction: column !important; }

  .opf-sidebar {
    position: static;      /* sidebar is not sticky on mobile — button handles that */
    width: 100%;
    max-width: 100%;
    flex: none;
  }

  /* Show mobile toggle button */
  .opf-mobile-toggle-btn { display: inline-flex; }

  /* Sticky mobile toggle so it persists when user scrolls (item 3) */
  .opf-mobile-toggle-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--opf-surface);
    padding: 8px 0;
    border-bottom: 1px solid var(--opf-border);
    margin-bottom: 8px;
  }
  .opf-mobile-toggle-sticky .opf-mobile-toggle-btn {
    margin-bottom: 0;
  }

  /* Mobile: always 2 columns regardless of chosen desktop setting (item 6) */
  .opf-product-grid,
  .opf-product-grid.opf-cols-1,
  .opf-product-grid.opf-cols-2,
  .opf-product-grid.opf-cols-3,
  .opf-product-grid.opf-cols-4,
  .opf-product-grid.opf-cols-5,
  .opf-product-grid.opf-cols-6 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
}

@media (max-width: 380px) {
  /* Very small phones: still 2 col but smaller gap */
  .opf-product-grid { gap: 8px !important; }
  .opf-price-inputs { flex-direction: column; }
  .opf-price-sep { display: none; }
}
