/* ── WooGlobalFilters — Frontend CSS ──────────────────────────────────────
   All selectors are intentionally non-specific so Elementor's generated
   CSS (which includes the widget wrapper class) can override any value.
   ────────────────────────────────────────────────────────────────────── */

:root {
  --wglf-accent:        #1d4ed8;
  --wglf-accent-hover:  #1e40af;
  --wglf-border:        #d0d5dd;
  --wglf-text:          #1f2937;
  --wglf-muted:         #6b7280;
  --wglf-bg-light:      #f3f4f6;
  --wglf-radius:        6px;
  --wglf-transition:    0.18s ease;
}

/* ════════════════════════════════════════════════════════════════════════
   FILTER FORM
   ════════════════════════════════════════════════════════════════════════ */

.wglf-filters {
  display: grid;
  gap: 16px;
  color: var(--wglf-text);
}

/* ── Widget title ───────────────────────────────────────────────────────── */
.wglf-widget-title {
  margin: 0 0 12px;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--wglf-text);
}

/* ── Filter group ───────────────────────────────────────────────────────── */
.wglf-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Collapsible state */
.wglf-filter-group.is-collapsed .wglf-group-options,
.wglf-filter-group.is-collapsed .wglf-search-wrapper {
  display: none !important;
}

.wglf-filter-group.is-collapsed .wglf-collapse-icon {
  transform: rotate(0deg);
}

/* ── Group label / header ───────────────────────────────────────────────── */
.wglf-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0 10px;
  border: none;
  border-bottom: 1px solid var(--wglf-border);
  background: none;
  font-size: inherit;
  font-weight: 600;
  color: var(--wglf-text);
  cursor: pointer;
  text-align: left;
  margin-bottom: 10px;
  transition: color var(--wglf-transition);
}

.wglf-group-label:hover {
  color: var(--wglf-accent);
}

.wglf-collapse-icon {
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
  user-select: none;
  transition: transform 0.2s ease;
}

/* ── Group options wrapper ──────────────────────────────────────────────── */
.wglf-group-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Individual option ──────────────────────────────────────────────────── */
.wglf-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  line-height: 1.4;
  transition: color var(--wglf-transition);
}

.wglf-filter-option span {
  flex: 1;
  color: var(--wglf-text);
  transition: color var(--wglf-transition);
}

.wglf-filter-option:hover span {
  color: var(--wglf-accent);
}

.wglf-filter-option:has(input:checked) span {
  color: var(--wglf-accent);
  font-weight: 600;
}

.wglf-filter-option input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--wglf-accent);
  cursor: pointer;
}

/* ── Term count badge ───────────────────────────────────────────────────── */
.wglf-term-count {
  margin-left: auto;
  font-size: 11px;
  font-style: normal;
  color: var(--wglf-muted);
  background: var(--wglf-bg-light);
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
  transition: background var(--wglf-transition), color var(--wglf-transition);
}

/* ── Button-style options ───────────────────────────────────────────────── */
.wglf-group-options--buttons {
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 8px !important;
}

.wglf-filter-option--button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--wglf-border);
  border-radius: var(--wglf-radius);
  background: #fff;
  cursor: pointer;
  transition: all var(--wglf-transition);
}

.wglf-filter-option--button input[type="checkbox"] {
  display: none !important; /* Hide checkbox */
}

.wglf-filter-option--button span {
  font-size: 13px;
  color: var(--wglf-text);
  font-weight: 400 !important;
}

.wglf-filter-option--button:hover {
  border-color: var(--wglf-accent);
  background: var(--wglf-bg-light);
}

.wglf-filter-option--button:has(input:checked) {
  background: var(--wglf-accent);
  border-color: var(--wglf-accent);
}

.wglf-filter-option--button:has(input:checked) span {
  color: #fff !important;
  font-weight: 500 !important;
}

/* ── Group search field ─────────────────────────────────────────────────── */
.wglf-search-wrapper {
  margin-bottom: 10px;
}

.wglf-group-search {
  width: 100%;
  padding: 6px 10px 6px 28px;
  border: 1px solid var(--wglf-border);
  border-radius: var(--wglf-radius);
  font-size: 13px;
  color: var(--wglf-text);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 8px center;
  transition: border-color var(--wglf-transition);
  box-sizing: border-box;
}

.wglf-group-search:focus {
  border-color: var(--wglf-accent);
  outline: none;
}

/* ── Price range list ─────────────────────────────────────────────────────── */
.wglf-price-ranges {
  flex-direction: column;
  gap: 6px;
}

.wglf-price-range-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  line-height: 1.4;
  transition: color var(--wglf-transition);
}

.wglf-price-range-option input[type="radio"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--wglf-accent);
  cursor: pointer;
}

.wglf-price-range-option span {
  flex: 1;
  color: var(--wglf-text);
  transition: color var(--wglf-transition);
}

.wglf-price-range-option:hover span {
  color: var(--wglf-accent);
}

.wglf-price-range-option:has(input:checked) span {
  color: var(--wglf-accent);
  font-weight: 600;
}

/* ── "Más opciones" button ───────────────────────────────────────── */
.wglf-more-options-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--wglf-accent);
  font-size: 13px;
  cursor: pointer;
  transition: color var(--wglf-transition);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wglf-more-options-btn:hover {
  color: var(--wglf-accent-hover);
}

.wglf-more-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
}

/* ── Expanded extra options — scrollable container ────────────────── */
.wglf-group-options--more {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
  border-top: 1px solid var(--wglf-border);
  padding-top: 6px;
  margin-top: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--wglf-border) transparent;
}

.wglf-group-options--more::-webkit-scrollbar {
  width: 5px;
}

.wglf-group-options--more::-webkit-scrollbar-track {
  background: transparent;
}

.wglf-group-options--more::-webkit-scrollbar-thumb {
  background: var(--wglf-border);
  border-radius: 3px;
}

/* ── Clear filters button ───────────────────────────────────────────────── */
.wglf-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 14px;
  margin-top: 4px;
  border: 1px solid var(--wglf-border);
  border-radius: var(--wglf-radius);
  background: transparent;
  color: var(--wglf-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--wglf-transition), color var(--wglf-transition), border-color var(--wglf-transition);
}

.wglf-clear-btn:hover {
  background: var(--wglf-bg-light);
  color: var(--wglf-text);
  border-color: #9ca3af;
}

/* ════════════════════════════════════════════════════════════════════════
   PRODUCTS GRID
   ════════════════════════════════════════════════════════════════════════ */

.wglf-products-grid {
  min-height: 120px;
  transition: opacity 0.22s ease;
}

.wglf-products-grid.is-loading,
.products.is-loading {
  opacity: 0.4;
  pointer-events: none;
}

/* Force WooCommerce products list into CSS Grid
   Column count is controlled by Elementor's responsive columns control.
   These are fallback defaults. */
.wglf-products-grid ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Remove WooCommerce float/width overrides */
.wglf-products-grid ul.products li.product {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  clear: none !important;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.wglf-empty {
  padding: 32px 16px;
  color: var(--wglf-muted);
  text-align: center;
  font-size: 14px;
}

/* ════════════════════════════════════════════════════════════════════════
   PAGINATION
   ════════════════════════════════════════════════════════════════════════ */

.wglf-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
}

.wglf-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--wglf-border);
  border-radius: var(--wglf-radius);
  background: #fff;
  color: var(--wglf-text);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--wglf-transition), color var(--wglf-transition), border-color var(--wglf-transition);
}

.wglf-page-btn:hover,
.wglf-page-btn.is-active {
  background: var(--wglf-accent);
  border-color: var(--wglf-accent);
  color: #fff;
}

/* ════════════════════════════════════════════════════════════════════════
   MOBILE TOGGLE & DRAWER
   ════════════════════════════════════════════════════════════════════════ */

.wglf-mobile-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--wglf-border);
  border-radius: var(--wglf-radius);
  background: #fff;
  color: var(--wglf-text);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--wglf-transition), border-color var(--wglf-transition);
}

.wglf-mobile-toggle:hover {
  background: var(--wglf-bg-light);
  border-color: #9ca3af;
}

/* ════════════════════════════════════════════════════════════════════════
   ELEMENTOR EDITOR — onboarding notice
   ════════════════════════════════════════════════════════════════════════ */

.wglf-editor-notice {
  padding: 24px 20px;
  border: 2px dashed #c0c7d0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.wglf-notice-icon {
  font-size: 28px;
  display: block;
  text-align: center;
  margin-bottom: 10px;
}

.wglf-editor-notice p {
  margin: 0 0 8px;
  text-align: center;
}

.wglf-notice-steps {
  margin: 12px 0 0;
  padding-left: 20px;
  text-align: left;
}

.wglf-notice-steps li {
  margin-bottom: 6px;
}

.wglf-notice-steps a {
  color: var(--wglf-accent);
  text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════════════════
   RESPONSIVE — defaults (Elementor controls override per-widget)
   ════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .wglf-products-grid ul.products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .wglf-mobile-toggle {
    display: inline-flex;
  }

  /* Slide-in drawer */
  .wglf-filters {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(85vw, 320px);
    background: #fff;
    padding: 24px 20px;
    border-right: 1px solid var(--wglf-border);
    transform: translateX(-105%);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    z-index: 99999;
    overflow-y: auto;
  }

  .wglf-filters.is-open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.15);
  }

  .wglf-products-grid ul.products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .wglf-products-grid ul.products {
    grid-template-columns: 1fr;
  }
}
