/**
 * MSW Categories — styles du widget Catégories produits.
 * Liste hiérarchique en liens HTML statiques avec support indentation,
 * vignette optionnelle, état actif et ancêtres.
 */

.msw-categories {
  --msw-cat-indent: 16px;
  --msw-cat-link: var(--msw-text, #1a1a1a);
  --msw-cat-link-hover: var(--msw-accent, #3b82f6);
  --msw-cat-active: var(--msw-accent, #3b82f6);
  --msw-cat-count: var(--msw-text-secondary, #6b7280);
  --msw-cat-toggle-size: 24px;

  color: var(--msw-cat-link);
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
}

.msw-categories *,
.msw-categories *::before,
.msw-categories *::after {
  box-sizing: border-box;
}

.msw-categories {
  margin-top: 40px;
  margin-bottom: 20px;
}

.msw-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.msw-cat-list--children {
  margin-left: var(--msw-cat-indent);
  padding-left: 8px;
  margin-top: 2px;
  overflow: hidden;
  max-height: none;
  opacity: 1;
  transition: max-height 0.28s ease, opacity 0.22s ease;
}

.msw-cat--has-children:not(.msw-cat--expanded) > .msw-cat-list--children {
  max-height: 0;
  opacity: 0;
}

.msw-cat__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.msw-cat__thumb {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 2px;
}

.msw-cat__link {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  color: var(--msw-cat-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

.msw-cat__link:hover,
.msw-cat__link:focus-visible {
  color: var(--msw-cat-link-hover);
  text-decoration: none;
}

.msw-cat__name {
  flex: 1 1 auto;
}

.msw-cat__count {
  font-size: 12px;
  color: var(--msw-cat-count);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.msw-cat__toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--msw-cat-toggle-size);
  height: var(--msw-cat-toggle-size);
  border: 0;
  border-radius: 6px;
  padding: 0;
  margin-left: 2px;
  cursor: pointer;
  color: var(--msw-cat-count);
  background: transparent;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.msw-cat__toggle:hover,
.msw-cat__toggle:focus-visible {
  color: var(--msw-cat-link-hover);
  background-color: rgba(59, 130, 246, 0.1);
  outline: none;
}

.msw-cat__toggle-icon {
  display: inline-flex;
  transition: transform 0.24s ease;
}

.msw-cat--expanded > .msw-cat__row .msw-cat__toggle-icon {
  transform: rotate(0deg);
}

.msw-cat--has-children:not(.msw-cat--expanded) > .msw-cat__row .msw-cat__toggle-icon {
  transform: rotate(-90deg);
}

.msw-cat--active > .msw-cat__row .msw-cat__link {
  color: var(--msw-cat-active);
  font-weight: 600;
}

.msw-cat--ancestor > .msw-cat__row .msw-cat__link {
  font-weight: 500;
}

.msw-cat-error {
  padding: 12px 16px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

.msw-cat-empty {
  margin: 0;
  color: var(--msw-cat-count);
  font-style: italic;
  font-size: 13px;
}
