.ip-zagregowane-kolory {
  display: grid;
  gap: 0.75rem;
  margin: 12px 0 14px;
  padding: 0;
}

.woocommerce .ip-zagregowane-kolory-toolbar-row,
.woocommerce-page .ip-zagregowane-kolory-toolbar-row {
  display: block !important;
  width: 100%;
  min-width: 100%;
  flex: 0 0 100%;
  flex-basis: 100%;
  clear: both;
  float: none;
  align-self: stretch;
  margin-top: 8px;
  margin-bottom: 14px;
}

.woocommerce .ip-zagregowane-kolory--archive-slot,
.woocommerce-page .ip-zagregowane-kolory--archive-slot {
  display: block;
  width: 100%;
  flex: 0 0 100%;
  flex-basis: 100%;
  clear: both;
  margin: 0;
}

.woocommerce .ip-zagregowane-kolory-toolbar-row .ip-zagregowane-kolory,
.woocommerce-page .ip-zagregowane-kolory-toolbar-row .ip-zagregowane-kolory {
  margin: 0;
}

.woocommerce .woocommerce-result-count,
.woocommerce-page .woocommerce-result-count {
  margin: 0 0 8px;
  float: left;
}

.woocommerce .woocommerce-ordering,
.woocommerce-page .woocommerce-ordering {
  margin: 0 0 8px;
  float: right;
}

.ip-zagregowane-kolory__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 600;
}

.ip-zagregowane-kolory__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
}

.ip-zagregowane-kolory__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 120ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.ip-zagregowane-kolory.has-selection .ip-zagregowane-kolory__chip.is-dimmed {
  opacity: 0.45;
}

.ip-zagregowane-kolory.has-selection .ip-zagregowane-kolory__chip.is-dimmed:hover,
.ip-zagregowane-kolory.has-selection .ip-zagregowane-kolory__chip.is-dimmed:focus-visible {
  opacity: 0.78;
}

.ip-zagregowane-kolory__chip:focus-visible {
  outline: 2px solid #64748b;
  outline-offset: 2px;
}

.ip-zagregowane-kolory__label {
  font-size: 0.92rem;
  font-weight: 500;
}

.ip-zagregowane-kolory__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.34rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  line-height: 1.1;
}

/* DARK (legacy/default) */
.ip-zagregowane-kolory--dark .ip-zagregowane-kolory__chip {
  border: 1px solid rgba(115, 140, 173, 0.35);
  background: rgba(49, 74, 110, 0.2);
  color: #dfe8f4;
}

.ip-zagregowane-kolory--dark .ip-zagregowane-kolory__chip:hover {
  border-color: rgba(147, 179, 218, 0.6);
  background: rgba(72, 103, 149, 0.32);
  transform: translateY(-1px);
}

.ip-zagregowane-kolory--dark .ip-zagregowane-kolory__chip.is-active {
  border-color: rgba(130, 189, 255, 0.9);
  background: rgba(82, 139, 204, 0.45);
}

.ip-zagregowane-kolory--dark .ip-zagregowane-kolory__count {
  background: rgba(255, 255, 255, 0.16);
  color: #f5f8ff;
}

/* LIGHT */
.ip-zagregowane-kolory--light .ip-zagregowane-kolory__panel,
.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__panel {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 18px;
  border: 1px solid #d9dee5;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  color: #2b3440;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__title,
.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__list {
  justify-content: flex-start;
  gap: 10px 8px;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip {
  border: 1px solid #d3dae3;
  background: #f8fafc;
  color: #334155;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip:link,
.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip:visited {
  color: #334155 !important;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip:hover {
  border-color: #b8c4d2;
  background: #f1f5f9;
  color: #334155 !important;
  transform: translateY(-1px);
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip.is-active {
  border-color: #64748b;
  background: #eaf1f7;
  color: #1f2937;
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.18);
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip.is-active:link,
.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip.is-active:visited,
.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip.is-active:hover {
  color: #1f2937 !important;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__label {
  color: #334155;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__count {
  background: #e9eef5;
  color: #475569;
}

.ip-zagregowane-kolory--light .ip-zagregowane-kolory__chip.is-active .ip-zagregowane-kolory__count {
  background: #cbd5e1;
  color: #1f2937;
}

.ip-zagregowane-kolory--dark .ip-zagregowane-kolory__chip--reset {
  border-style: dashed;
}

/* ICON VARIANT */
.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__list {
  justify-content: center;
  gap: 8px;
}

.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__chip {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.ip-zagregowane-kolory__icon-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.15);
  background: #8da2b8;
}

.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__chip:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__chip.is-active {
  box-shadow: 0 0 0 2px #64748b;
  border-color: #64748b;
  background: #f8fafc;
}

.ip-zagregowane-kolory--icon.has-selection .ip-zagregowane-kolory__chip.is-dimmed {
  opacity: 0.38;
}

.ip-zagregowane-kolory--icon .ip-zagregowane-kolory__chip.is-active::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 1px #fff;
}

.ip-zagregowane-kolory--icon .ip-color-swatch--reset .ip-zagregowane-kolory__icon-dot {
  border-radius: 6px;
  background: conic-gradient(from 20deg, #58a4ff 0 10%, #36c46c 10% 20%, #a5cf39 20% 30%, #f2d54e 30% 40%, #ffb740 40% 50%, #ff7d4c 50% 60%, #df5f9a 60% 70%, #9a6ce0 70% 80%, #5ec9d9 80% 90%, #7f96b0 90% 100%);
}

.ip-zagregowane-kolory--icon .ip-color-swatch--reset {
  border-radius: 8px;
}

.ip-color-swatch--bialy .ip-zagregowane-kolory__icon-dot,
.ip-color-swatch--srebrny .ip-zagregowane-kolory__icon-dot,
.ip-color-swatch--zloty .ip-zagregowane-kolory__icon-dot {
  border: 1px solid rgba(62, 73, 84, 0.45);
}

.ip-color-swatch--wielokolorowy .ip-zagregowane-kolory__icon-dot {
  background: linear-gradient(135deg, #3b82c4 0%, #3b82c4 25%, #4aa366 25%, #4aa366 50%, #d9b938 50%, #d9b938 75%, #c85a5a 75%, #c85a5a 100%);
}

.ip-color-swatch--przezroczysty .ip-zagregowane-kolory__icon-dot {
  background:
    linear-gradient(45deg, rgba(115, 134, 156, 0.15) 25%, transparent 25%, transparent 75%, rgba(115, 134, 156, 0.15) 75%),
    linear-gradient(45deg, rgba(115, 134, 156, 0.15) 25%, transparent 25%, transparent 75%, rgba(115, 134, 156, 0.15) 75%);
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
  border: 1px solid rgba(74, 94, 116, 0.5);
}

.ip-zagregowane-kolory__title--center {
  text-align: center;
  margin-bottom: 10px;
  font-size: 15px;
}

.ip-zagregowane-kolory__subtitle {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.25;
}

.ip-zagregowane-kolory__subtitle--center {
  text-align: center;
  margin-bottom: 10px;
}

/* Divi 5 / Loop Builder compatibility */
.et_builder_inner_content .ip-zagregowane-kolory,
.et_pb_module .ip-zagregowane-kolory,
.et_pb_wc_shop .ip-zagregowane-kolory,
.et_pb_db_shop_loop .ip-zagregowane-kolory {
  box-sizing: border-box;
  max-width: 100%;
}

.et_builder_inner_content .ip-zagregowane-kolory *,
.et_pb_module .ip-zagregowane-kolory * {
  box-sizing: border-box;
}

.et_builder_inner_content .ip-zagregowane-kolory__chip,
.et_pb_module .ip-zagregowane-kolory__chip {
  text-decoration: none !important;
  line-height: 1.2;
}

.et_builder_inner_content .ip-zagregowane-kolory-toolbar-row,
.et_pb_module .ip-zagregowane-kolory-toolbar-row {
  clear: both;
  width: 100%;
}

.ip-zagregowane-kolory__chip[aria-current="true"],
.ip-zagregowane-kolory__chip.is-active {
  cursor: pointer;
}

@media (max-width: 767px) {
  .ip-zagregowane-kolory--light .ip-zagregowane-kolory__panel,
  .ip-zagregowane-kolory--icon .ip-zagregowane-kolory__panel {
    max-width: none;
    padding: 14px 12px;
  }

  .ip-zagregowane-kolory__list {
    gap: 8px 6px;
  }

  .ip-zagregowane-kolory__chip {
    padding: 7px 10px;
  }
}
