/* Category Menu Context Styles */

/* Podstawowe style dla różnych kontekstów */
.zamel-categories-tree {
  transition: all 0.3s ease;
}

/* Context indicators */
.zamel-categories-tree.context-global {
  /* Główna strona produktów - standardowe zachowanie */
}

.zamel-categories-tree.context-brand {
  /* Strona brandu - bardziej otwarte menu */
}

.zamel-categories-tree.context-filtered {
  /* Tryb filtrowania - zachowaj otwarte sekcje */
}

/* Enhanced category toggle buttons */
.zamel-category-toggle {
  transition: all 0.2s ease;
  border-radius: 3px;
}

.zamel-category-toggle:hover {
  border-color: #c82333;
}

.zamel-category-toggle:focus {
  outline: 2px solid #c82333;
  outline-offset: 2px;
}

/* Context-specific styling */
.context-brand .zamel-category-toggle {
  border-color: #6c757d;
}

.context-filtered .zamel-category-toggle {
  border-color: #c82333;
}

/* Active category highlighting - INCREASED SPECIFICITY to override custom-menu-products.css */
.zamel-categories-tree .zamel-category-link.zamel-active {
  background-color: #f8f9fa !important;
  border-left: 3px solid #c82333 !important;
  padding-left: 8px !important;
  font-weight: 600 !important;
  color: #c82333 !important;
}

.zamel-categories-tree .zamel-category-link.zamel-active .zamel-category-name {
  color: #c82333 !important;
}

/* Smooth transitions for expand/collapse */
.zamel-category-children {
  transition: all 0.3s ease;
  overflow: hidden;
}

.zamel-category-children.zamel-hidden {
  max-height: 0;
  opacity: 0;
}

.zamel-category-children:not(.zamel-hidden) {
  max-height: 1000px; /* Adjust based on your needs */
  opacity: 1;
}

/* Better visual hierarchy */
.zamel-category-item[data-level="0"] {
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.zamel-category-item[data-level="1"] {
  margin-left: 12px;
}

.zamel-category-item[data-level="2"] {
  margin-left: 24px;
}

/* Root category (brand) special styling */
.zamel-category-root {
  font-weight: 600;
  color: #333;
  text-decoration: none;
}

.zamel-category-root:hover {
  color: #c82333;
  text-decoration: underline;
}

/* Child category styling */
.zamel-category-child {
  color: #666;
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.zamel-category-child:hover {
  color: #c82333;
  text-decoration: none;
}

/* NADPISANIE stylów z custom-menu-prroducts.css */

/* Usuń szare tło hover i czerwoną obramówkę */
.zamel-categories-tree .zamel-category-link:hover {
  background-color: transparent !important;
  color: #c82333 !important;
}

.zamel-categories-tree .zamel-category-link.zamel-category-root:hover {
  background-color: transparent !important;
  color: #c82333 !important;
  border-color: transparent !important; /* Usuń czerwoną obramówkę */
}

.zamel-categories-tree .zamel-category-link.zamel-category-child:hover {
  background-color: transparent !important;
  color: #c82333 !important;
}

/* Nadpisz active styles - usuń różową obramówkę */
.zamel-categories-tree .zamel-category-link.zamel-active {
  background-color: #f8f9fa !important; /* Zachowaj subtelne tło */
  color: #c82333 !important;
  font-weight: 600 !important;
  border: none !important; /* Usuń obramówkę */
  padding-left: 8px !important;
  border-left: 3px solid #c82333 !important; /* Tylko lewa kreska */
}

.zamel-categories-tree .zamel-category-link.zamel-active:hover {
  background-color: #f8f9fa !important;
  color: #c82333 !important;
}

/* Usuń focus outline i inne obramówki po kliknięciu */
.zamel-categories-tree .zamel-category-link:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.zamel-categories-tree .zamel-category-link.zamel-active:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  border-left: 3px solid #c82333 !important; /* Zachowaj tylko lewą kreskę */
}

/* Usuń focus outline z przycisków toggle */
.zamel-categories-tree .zamel-category-toggle:focus {
  outline: none !important;
  border-color: #e6e6e6 !important; /* Zachowaj normalny border */
  box-shadow: none !important;
}

.zamel-categories-tree .zamel-category-toggle:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Loading states */
.zamel-category-link[aria-busy="true"]::after {
  content: "...";
  color: #999;
  margin-left: 8px;
}

/* Category count styling */
.zamel-category-count {
  color: #999;
  font-size: 0.9em;
  margin-left: 8px;
}

.zamel-categories-tree .zamel-category-link.zamel-active .zamel-category-count {
  color: #c82333 !important;
  font-weight: 500 !important;
}

/* Context indicators for debugging */
#zamel-context-indicator {
  font-family: monospace;
  white-space: nowrap;
  user-select: none;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .zamel-category-toggle {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 18px;
  }
  
  .zamel-category-item[data-level="1"] {
    margin-left: 8px;
  }
  
  .zamel-category-item[data-level="2"] {
    margin-left: 16px;
  }
  
  .zamel-category-link {
    padding: 8px 4px;
  }
}

/* Enhanced accordion animations */
.zamel-category-toggle .zamel-toggle-icon {
  transition: transform 0.3s ease;
}

.zamel-category-toggle[aria-expanded="true"] .zamel-toggle-icon {
  transform: rotate(180deg);
}

/* Focus management */
.zamel-category-link:focus,
.zamel-category-toggle:focus {
  outline: 2px solid #c82333;
  outline-offset: 2px;
  z-index: 1;
  position: relative;
}

/* Context-aware spacing */
.context-brand .zamel-category-item {
  margin-bottom: 4px;
}

.context-filtered .zamel-category-item {
  margin-bottom: 6px;
}

/* Special highlighting for filtered state */
.context-filtered .zamel-categories-tree .zamel-category-link.zamel-active {
  background-color: #f8f9fa !important;
  border-left-color: #c82333 !important;
}

.context-filtered .zamel-categories-tree .zamel-category-link.zamel-active .zamel-category-name {
  color: #c82333 !important;
}

/* Brand page context styling */
.context-brand .zamel-category-root {
  background-color: #f8f9fa;
  padding: 8px 12px;
  border-radius: 4px;
  border-left: 4px solid #6c757d;
}

/* Accessibility improvements */
.zamel-category-toggle[aria-expanded="true"] {
  background-color: #f8f9fa;
}

.zamel-screen-reader-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}