/**
 * archive.css — icontrol.pt
 * Listagem de produtos.
 */

.ict-cat-hero {
  max-width: var(--ict-container);
  margin: 0 auto;
  padding: 20px 16px 20px;
}

/* Hero 2-col grid (desktop) */
.ict-cat-hero-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 32px;
  align-items: center;
}

.ict-cat-hero-left .ict-section-label { display: inline-flex; margin-bottom: 12px; }

.ict-breadcrumb {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--ict-text-muted);
  margin-bottom: 12px;
  font-family: var(--ict-font-mono);
  flex-wrap: wrap;
}

.ict-breadcrumb a { color: var(--ict-text-muted); text-decoration: none; }
.ict-breadcrumb a:hover { color: var(--ict-accent); }
.ict-breadcrumb .sep { opacity: 0.5; }
.ict-breadcrumb .current { color: var(--ict-text); font-weight: 500; }

.ict-cat-hero h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.ict-cat-desc {
  font-size: 14px;
  color: var(--ict-text-dim);
  line-height: 1.5;
  margin-bottom: 16px;
}

.ict-cat-sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background: var(--ict-surface);
  border: 1px solid var(--ict-border);
  border-radius: 12px;
  box-shadow: var(--ict-shadow-sm);
  /* height is always auto — cresce com o conteúdo, nunca sobrepõe */
}

.ict-cat-sub-nav a {
  padding: 6px 10px;
  background: var(--ict-surface-2);
  border: 1px solid var(--ict-border);
  border-radius: 7px;
  color: var(--ict-text-dim);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ict-cat-sub-nav a:hover {
  border-color: var(--ict-accent);
  color: var(--ict-accent);
  background: var(--ict-accent-tint);
}

.ict-cat-sub-nav a .count {
  font-family: var(--ict-font-mono);
  font-size: 10px;
  color: var(--ict-text-muted);
}

/* Layout */
.ict-archive-layout {
  max-width: var(--ict-container);
  margin: 0 auto;
  padding: 12px 16px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Mobile toolbar */
.ict-mobile-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.ict-mobile-toolbar .ict-filters-toggle {
  flex: 1;
  padding: 10px 14px;
  background: var(--ict-surface);
  border: 1px solid var(--ict-border);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ict-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  font-family: inherit;
}

.ict-mobile-toolbar select.ict-sort {
  flex: 1;
  padding: 10px 12px;
  background: var(--ict-surface);
  border: 1px solid var(--ict-border);
  border-radius: 9px;
  font-size: 13px;
  color: var(--ict-text);
  font-family: inherit;
  min-height: 44px;
}

/* Sidebar filtros (drawer mobile) */
.ict-filters-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 85%;
  max-width: 360px;
  height: 100vh;
  background: var(--ict-bg);
  z-index: 1000;
  overflow-y: auto;
  padding: 16px;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: var(--ict-shadow-lg);
}

.ict-filters-sidebar.open { transform: translateX(0); }

.ict-filters-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.ict-filters-overlay.visible { display: block; }

.ict-filters-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ict-border);
}

.ict-filters-drawer-header h3 { font-size: 16px; font-weight: 600; }

.ict-filters-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ict-text-dim);
}

.ict-filter-block {
  background: var(--ict-surface);
  border: 1px solid var(--ict-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.ict-filter-block-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.ict-filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.ict-filter-option label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ict-text-2);
  cursor: pointer;
  flex: 1;
  min-height: 24px;
}

.ict-filter-option .count {
  font-family: var(--ict-font-mono);
  font-size: 11px;
  color: var(--ict-text-muted);
}

.ict-filter-option input[type="checkbox"],
.ict-filter-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ict-accent);
}

.ict-filters-apply {
  position: sticky;
  bottom: 0;
  padding: 12px 0;
  background: var(--ict-bg);
  border-top: 1px solid var(--ict-border);
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.ict-filters-apply .ict-btn { flex: 1; }

/* Desktop toolbar */
.ict-toolbar {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--ict-surface);
  border: 1px solid var(--ict-border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.ict-toolbar-left {
  font-size: 13px;
  color: var(--ict-text-dim);
}

.ict-toolbar-left strong { color: var(--ict-text); }

.ict-results-count {
  font-size: 12px;
  color: var(--ict-text-muted);
  margin-bottom: 12px;
  font-family: var(--ict-font-mono);
}

/* Grid de produtos */
.ict-prod-grid,
ul.products {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.products li.product {
  width: auto !important;
  margin: 0 !important;
  float: none !important;
}

/* Estilos das product cards definidos em main.css (partilhados com homepage) */

/* Paginação */
.woocommerce-pagination {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.woocommerce-pagination ul.page-numbers {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.woocommerce-pagination .page-numbers {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  background: var(--ict-surface);
  border: 1px solid var(--ict-border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ict-text-dim);
  font-family: var(--ict-font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.woocommerce-pagination .page-numbers.current {
  background: var(--ict-text);
  color: #fff;
  border-color: var(--ict-text);
}

.woocommerce-pagination .page-numbers:hover:not(.current) {
  border-color: var(--ict-accent);
  color: var(--ict-accent);
}

/* DESKTOP (≥ 768px) */
@media (min-width: 768px) {
  .ict-cat-hero { padding: 28px 0 32px; }
  .ict-cat-hero h1 { font-size: 40px; }
  .ict-cat-desc { font-size: 15px; max-width: 560px; }
  .ict-cat-hero-grid { grid-template-columns: auto 1fr; gap: 0 32px; align-items: start; }
  .ict-cat-sub-nav { width: 100%; }
  .ict-prod-grid,
  ul.products { grid-template-columns: repeat(3, 1fr) !important; gap: 14px; }
  /* .ict-prod-info, .ict-prod-name, .ict-prod-price — definidos em main.css */
}

/* DESKTOP LARGE (≥ 1024px) */
@media (min-width: 1024px) {
  .ict-archive-layout {
    grid-template-columns: 260px 1fr;
    gap: 24px;
    padding: 12px 0 80px;
  }

  .ict-filters-sidebar {
    position: sticky;
    top: 88px;
    left: auto;
    width: auto;
    max-width: none;
    height: auto;
    max-height: calc(100vh - 100px);
    transform: none !important;
    background: transparent;
    box-shadow: none;
    padding: 0;
    z-index: auto;
    align-self: start;
  }

  .ict-filters-drawer-header { display: none; }
  .ict-filters-apply { display: none; }
  .ict-filters-overlay { display: none !important; }
  .ict-mobile-toolbar { display: none; }
  .ict-toolbar { display: flex; }

  .ict-prod-grid,
  ul.products { grid-template-columns: repeat(3, 1fr) !important; }
  .ict-prod-card .ict-stock-pill .ict-stock-prazo { display: inline; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   REACTIVE FILTERS — collapsible, price slider, greyed states, AJAX loader
   ───────────────────────────────────────────────────────────────────────────── */

/* Filter block title — now a button */
.ict-filter-block-title {
  all: unset;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
  width: 100%;
  color: var(--ict-text);
  user-select: none;
}

.ict-filter-block-title:hover {
  color: var(--ict-accent);
  background: rgba(13,124,94,0.07) !important;
  background-color: rgba(13,124,94,0.07) !important;
  box-shadow: none !important;
}

/* Chevron rotates when collapsed */
.ict-filter-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--ict-text-muted);
}

.ict-filter-block--collapsed .ict-filter-chevron {
  transform: rotate(-90deg);
}

/* Filter body hidden when collapsed */
.ict-filter-body {
  overflow: hidden;
  transition: all 0.2s ease;
}

.ict-filter-block--collapsed .ict-filter-body {
  display: none;
}

/* Collapsed title has no bottom margin */
.ict-filter-block--collapsed .ict-filter-block-title {
  margin-bottom: 0;
}

/* ─── Radio deselect hint ────────────────────────────────────────────────── */
.ict-filter-option input[type="radio"] {
  cursor: pointer;
}

/* ─── Option: greyed out when count = 0 ─────────────────────────────────── */
.ict-filter-option.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

/* Option count */
.ict-filter-count {
  font-family: var(--ict-font-mono);
  font-size: 11px;
  color: var(--ict-text-muted);
  flex-shrink: 0;
  margin-left: 4px;
}

/* ─── Separador entre opções de filtro ───────────────────────────────────── */
.ict-filter-option + .ict-filter-option {
  border-top: 1px solid var(--ict-border);
}

/* ─── Botão limpar filtros ───────────────────────────────────────────────── */
.ict-btn-secondary {
  background: transparent;
  border: 1.5px solid var(--ict-border);
  color: var(--ict-text-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.ict-btn-secondary:hover {
  border-color: var(--ict-accent);
  color: var(--ict-accent);
}

/* ─── Badge de filtros activos (mobile) ──────────────────────────────────── */
.ict-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--ict-accent);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--ict-font-mono);
  margin-left: 2px;
}

/* ─── Price slider (noUiSlider theme overrides) ──────────────────────────── */
#ict-price-slider {
  margin: 4px 4px 20px;
}

/* noUiSlider base */
.noUi-target {
  background: var(--ict-surface-2);
  border: 1px solid var(--ict-border);
  border-radius: 4px;
  box-shadow: none;
  height: 4px;
}

.noUi-connect {
  background: var(--ict-accent);
}

.noUi-handle {
  width: 18px !important;
  height: 18px !important;
  right: -9px !important;
  top: -8px !important;
  border-radius: 50%;
  border: 2px solid var(--ict-accent);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  cursor: grab;
}

.noUi-handle:before,
.noUi-handle:after { display: none; }

.noUi-handle:active { cursor: grabbing; }

/* Price inputs */
.ict-price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ict-price-input-wrap {
  flex: 1;
  position: relative;
}

.ict-price-currency {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--ict-text-muted);
  pointer-events: none;
}

.ict-price-input {
  width: 100%;
  padding: 7px 8px 7px 22px;
  padding-left: 22px !important;
  border: 1.5px solid var(--ict-border);
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--ict-font-mono);
  color: var(--ict-text);
  background: var(--ict-surface);
  outline: none;
  box-sizing: border-box;
}

.ict-price-input:focus {
  border-color: var(--ict-accent);
  box-shadow: 0 0 0 2px var(--ict-accent-tint);
}

.ict-price-sep {
  font-size: 13px;
  color: var(--ict-text-muted);
  flex-shrink: 0;
}

/* ─── AJAX loader overlay ────────────────────────────────────────────────── */
#ict-shop-main {
  position: relative;
}

.ict-ajax-loader {
  display: none;
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 10;
  pointer-events: none;
}

.ict-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ict-border);
  border-top-color: var(--ict-accent);
  border-radius: 50%;
  animation: ict-spin 0.7s linear infinite;
}

@keyframes ict-spin {
  to { transform: rotate(360deg); }
}

/* ─── No-products message ─────────────────────────────────────────────────── */
.ict-no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 16px;
  color: var(--ict-text-muted);
  font-size: 14px;
}

/* ─── Pagination buttons (AJAX) ──────────────────────────────────────────── */
.woocommerce-pagination .ict-ajax-page {
  background: none;
  border: 1px solid var(--ict-border);
  cursor: pointer;
  font-family: inherit;
}

.woocommerce-pagination .ict-ajax-page:hover:not(.current) {
  border-color: var(--ict-accent);
  color: var(--ict-accent);
}

/* ─── Result count transition ─────────────────────────────────────────────── */
#ict-shop-results {
  transition: opacity 0.2s ease;
  min-height: 200px;
}

/* ─── Sort select desktop ─────────────────────────────────────────────────── */
#ict-sort-select-desktop {
  padding: 7px 12px;
  background: var(--ict-surface);
  border: 1.5px solid var(--ict-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ict-text);
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

#ict-sort-select-desktop:focus {
  border-color: var(--ict-accent);
}
