/* ============================================================
   Styrobud – Nawigacja kategorii
   Accent: #EC9B18  |  Radius: 12px  |  Border: 1px
   v1.1 – osobne widgety Desktop / Mobile
   ============================================================ */

/* ── RESET ───────────────────────────────────────────────── */
.sb-cat,
.sb-cat *,
.sb-cat *::before,
.sb-cat *::after {
  box-sizing: border-box;
}

/* ── ZMIENNE ─────────────────────────────────────────────── */
.sb-cat {
  --sb-accent:       #EC9B18;
  --sb-accent-dark:  #c9810e;
  --sb-accent-soft:  rgba(236, 155, 24, .08);
  --sb-accent-15:    rgba(236, 155, 24, .15);
  --sb-text:         #2d2d2d;
  --sb-text-light:   #666;
  --sb-bg:           #fff;
  --sb-border:       rgba(0, 0, 0, .08);
  --sb-radius:       12px;
  --sb-speed:        .3s;
  font-family: inherit;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   1. WIDOCZNOŚĆ – Desktop / Mobile
   ═══════════════════════════════════════════════════════════ */
.sb-cat--desktop-only { display: block; }
.sb-cat--mobile-only  { display: none; }

@media (max-width: 767px) {
  .sb-cat--desktop-only { display: none !important; }
  .sb-cat--mobile-only  { display: block !important; }
}

/* ═══════════════════════════════════════════════════════════
   2. HEADER (tytuł)
   ═══════════════════════════════════════════════════════════ */
.sb-cat__header {
  background-color: var(--sb-accent);
  padding: 13px 18px;
  border-radius: var(--sb-radius) var(--sb-radius) 0 0;
}

.sb-cat__title {
  margin: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   3. BACK BUTTON
   ═══════════════════════════════════════════════════════════ */
.sb-cat__back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  text-decoration: none !important;
  color: var(--sb-accent) !important;
  font-weight: 600;
  font-size: 13px;
  background: var(--sb-accent-soft);
  border-bottom: 1px solid var(--sb-border);
  transition: background var(--sb-speed) ease, color var(--sb-speed) ease;
  -webkit-tap-highlight-color: transparent;
}

.sb-cat__back:hover,
.sb-cat__back:focus-visible {
  background: var(--sb-accent-15);
  color: var(--sb-accent-dark) !important;
  outline: none;
}

.sb-cat__back-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: inherit;
}

.sb-cat__back-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   4. LISTA
   ═══════════════════════════════════════════════════════════ */
.sb-cat__list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-top: none;
  border-radius: 0 0 var(--sb-radius) var(--sb-radius);
  overflow: hidden;
}

/* Jeśli brak headera ani back → pierwsza lista zaokrąglona u góry */
.sb-cat__header + .sb-cat__list,
.sb-cat__back + .sb-cat__list {
  border-radius: 0 0 var(--sb-radius) var(--sb-radius);
}

/* Mobile panel → lista bez podwójnych ramek */
.sb-cat__panel .sb-cat__list {
  border-radius: var(--sb-radius);
  border: 1px solid var(--sb-border);
}

/* ═══════════════════════════════════════════════════════════
   5. ITEM
   ═══════════════════════════════════════════════════════════ */
.sb-cat__item {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-bottom: 1px solid var(--sb-border);
}

.sb-cat__item:last-child {
  border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════
   6. LINK (kafelek klikalny) + HOVER PODŚWIETLENIE
   ═══════════════════════════════════════════════════════════ */
.sb-cat__link {
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  padding: 14px 18px;
  text-decoration: none !important;
  color: var(--sb-text) !important;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
  overflow: hidden;
  background-color: transparent;
  transition: background-color var(--sb-speed) ease,
              color var(--sb-speed) ease;
  -webkit-tap-highlight-color: transparent;
}

/* Desktop hover – pomarańczowe podświetlenie */
.sb-cat__link:hover,
.sb-cat__link:focus-visible {
  background-color: var(--sb-accent);
  color: #fff !important;
  outline: none;
}

/* Mobile tap – delikatny pomarańcz (spójność z brandem) */
.sb-cat__link:active {
  background-color: var(--sb-accent-soft);
}

/* ═══════════════════════════════════════════════════════════
   7. NAZWA
   ═══════════════════════════════════════════════════════════ */
.sb-cat__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════
   8. STRZAŁKA
   ═══════════════════════════════════════════════════════════ */
.sb-cat__arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  transition: transform var(--sb-speed) ease;
  position: relative;
  z-index: 1;
}

.sb-cat__arrow img {
  display: block;
}

/* Domyślnie: ciemna widoczna, jasna ukryta */
.sb-cat__arrow-dark  { display: block; }
.sb-cat__arrow-light { display: none; position: absolute; inset: 0; margin: auto; }

/* Na hover: zamiana */
.sb-cat__link:hover .sb-cat__arrow-dark,
.sb-cat__link:focus-visible .sb-cat__arrow-dark {
  display: none;
}
.sb-cat__link:hover .sb-cat__arrow-light,
.sb-cat__link:focus-visible .sb-cat__arrow-light {
  display: block;
}

/* Strzałka powiększa się */
.sb-cat__link:hover .sb-cat__arrow,
.sb-cat__link:focus-visible .sb-cat__arrow {
  transform: scale(1.2);
}

/* ═══════════════════════════════════════════════════════════
   9. CURRENT (aktywna kategoria)
   ═══════════════════════════════════════════════════════════ */
.sb-cat__item.is-current > .sb-cat__link {
  background-color: var(--sb-accent);
  color: #fff !important;
  font-weight: 700;
}

.sb-cat__item.is-current > .sb-cat__link .sb-cat__arrow-dark  { display: none; }
.sb-cat__item.is-current > .sb-cat__link .sb-cat__arrow-light { display: block; }

/* ═══════════════════════════════════════════════════════════
   10. ANCESTOR (przodek bieżącej)
   ═══════════════════════════════════════════════════════════ */
.sb-cat__item.is-ancestor > .sb-cat__link {
  background-color: var(--sb-accent-soft);
  color: var(--sb-accent) !important;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   11. PODKATEGORIE (sub-levels)
   ═══════════════════════════════════════════════════════════ */
.sb-cat__list--sub {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* Depth 1 */
.sb-cat__list--depth-1 {
  background: #fafafa !important;
  border-top: 1px solid var(--sb-border) !important;
  position: relative;
}

/* Linia akcentu po lewej */
.sb-cat__list--depth-1::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--sb-accent);
  opacity: .22;
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
}

.sb-cat__list--depth-1 > .sb-cat__item > .sb-cat__link {
  padding-left: 32px;
  font-size: 13px;
  font-weight: 400;
}

/* Depth 2 */
.sb-cat__list--depth-2 {
  background: #f5f5f5 !important;
}

.sb-cat__list--depth-2 > .sb-cat__item > .sb-cat__link {
  padding-left: 48px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--sb-text-light) !important;
}

/* Depth 3 */
.sb-cat__list--depth-3 {
  background: #f0f0f0 !important;
}

.sb-cat__list--depth-3 > .sb-cat__item > .sb-cat__link {
  padding-left: 64px;
  font-size: 12px;
  font-weight: 400;
  color: var(--sb-text-light) !important;
}

/* Sub arrow mniejszy */
.sb-cat__item--sub .sb-cat__arrow img {
  width: 14px;
  height: 14px;
}

/* Current / hover nadpisania w sub */
.sb-cat__item--sub.is-current > .sb-cat__link {
  font-weight: 700 !important;
  color: #fff !important;
}

.sb-cat__item--sub > .sb-cat__link:hover,
.sb-cat__item--sub > .sb-cat__link:focus-visible {
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════
   12. MOBILE – details/summary dropdown
   ═══════════════════════════════════════════════════════════ */
.sb-cat__mobile-wrap {
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  background: var(--sb-bg);
  overflow: hidden;
}

/* Summary */
.sb-cat__summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--sb-accent);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.sb-cat__summary::-webkit-details-marker {
  display: none;
}

.sb-cat__summary-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sb-cat__summary-current {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  font-size: 13px;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

/* Chevron */
.sb-cat__summary-chevron {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  display: block;
  background-color: rgba(255,255,255,.85);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform var(--sb-speed) ease;
}

.sb-cat__mobile-wrap[open] > .sb-cat__summary .sb-cat__summary-chevron {
  transform: rotate(180deg);
}

/* Panel */
.sb-cat__panel {
  padding: 8px;
}

.sb-cat__panel .sb-cat__back {
  margin-bottom: 8px;
  border-radius: var(--sb-radius);
  border: 1px solid var(--sb-border);
}

/* Mobile link spacing */
.sb-cat__panel .sb-cat__link {
  padding: 12px 14px;
  font-size: 14px;
}

/* Mobile list */
.sb-cat__list--mobile {
  border-radius: var(--sb-radius) !important;
  border: 1px solid var(--sb-border) !important;
}

/* ═══════════════════════════════════════════════════════════
   13. TABLET (768–1024)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) {
  .sb-cat__link {
    padding: 12px 14px;
    font-size: 13px;
  }
}

/* ═══════════════════════════════════════════════════════════
   14. TOUCH DEVICES – wyłącz hover, zostaw :active feedback
   ═══════════════════════════════════════════════════════════ */
@media (hover: none) {
  /* Wyłącz hover podświetlenie (touch nie ma prawdziwego hover) */
  .sb-cat__link:hover {
    background-color: transparent;
    color: var(--sb-text) !important;
  }

  .sb-cat__link:hover .sb-cat__arrow {
    transform: none;
  }

  .sb-cat__link:hover .sb-cat__arrow-dark  { display: block; }
  .sb-cat__link:hover .sb-cat__arrow-light { display: none; }

  /* :active → delikatny pomarańczowy flash przy tapnięciu */
  .sb-cat__link:active {
    background-color: var(--sb-accent-soft);
    color: var(--sb-accent) !important;
  }

  .sb-cat__link:active .sb-cat__arrow-dark  { display: block; }
  .sb-cat__link:active .sb-cat__arrow-light { display: none; }

  /* Current — zawsze wyróżniony, niezależnie od hover/active */
  .sb-cat__item.is-current > .sb-cat__link,
  .sb-cat__item.is-current > .sb-cat__link:hover,
  .sb-cat__item.is-current > .sb-cat__link:active {
    background-color: var(--sb-accent);
    color: #fff !important;
  }

  .sb-cat__item.is-current > .sb-cat__link .sb-cat__arrow-dark,
  .sb-cat__item.is-current > .sb-cat__link:hover .sb-cat__arrow-dark {
    display: none;
  }

  .sb-cat__item.is-current > .sb-cat__link .sb-cat__arrow-light,
  .sb-cat__item.is-current > .sb-cat__link:hover .sb-cat__arrow-light {
    display: block;
  }
}

/* ═══════════════════════════════════════════════════════════
   15. PRINT
   ═══════════════════════════════════════════════════════════ */
@media print {
  .sb-cat--mobile-only  { display: none !important; }
  .sb-cat--desktop-only { display: block !important; }
  .sb-cat__arrow { display: none; }
}
