#block-webmedio-webmediojobcategoryfilterblock {
  max-width: 100%;
}

/* Category Filter Block
-------------------------------------------------*/

.webmedio-category-filter-wrapper h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  font-weight: bold;
  border-bottom: 2px solid #ccc;
  padding-bottom: 0.3em;
}

/* Ukryte elementy */
.hidden {
  display: none !important;
}

/* Wybrane kategorie */
.selected-categories-display {
  margin-bottom: 1rem;
}
.selected-categories-display h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
}
.selected-categories-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.selected-categories-list li {
  display: flex;
  align-items: center;
  background-color: #e0f0ff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #c0e0ff;
}
.remove-category {
  background: none;
  border: none;
  color: #0e1b77;
  font-weight: bold;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0 0 0.3rem;
  line-height: 1;
}
.remove-category:hover {
  color: #ff3333;
}



/* Styl dla body przy otwartym modalu */
body.modal-open {
  overflow: hidden;
}

/* Modal */
.categories-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.categories-modal-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.categories-modal-header {
  padding: 1rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.categories-modal-header h3 {
  margin: 0;
  font-size: 1.4rem;
}
.close-modal {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.categories-modal-body {
  padding: 1rem;
  overflow-y: auto;
  flex-grow: 1;
}
.categories-modal-footer {
  padding: 1rem;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Wyszukiwanie kategorii */
.category-search {
  margin-bottom: 1rem;
}
.search-input-wrapper {
  position: relative;
}
.search-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}
.search-input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

/* Drzewo kategorii */
.category-tree {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
}
.category-tree-container {
  max-height: 400px;
  overflow-y: auto;
}
.category-tree ul {
  list-style: none;
  padding-left: 1.2rem;
  margin: 0;
}
.category-tree ul li {
  padding: 0.3rem 0;
  position: relative;
}
.category-item {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}
.category-item:hover {
  background-color: #f0f0f0;
}
.category-item.selected {
  background-color: #e0f0ff;
  font-weight: bold;
}
.category-checkbox {
  margin-right: 0.5rem;
}
.toggle-children {
  margin-left: 0.5rem;
  display: inline-block;
  width: 1.2em;
  text-align: center;
  cursor: pointer;
}
.children.hidden {
  display: none;
}
.children.show {
  display: block;
}

/* Układ kolumn */
.column-split-3 {
  width: 33.333%;
  float: left;
}
@media (max-width: 768px) {
  .column-split-3 {
    width: 100%;
    float: none;
  }
}

/* Przycisk submit */
.form-actions {
  margin-top: 1rem;
  text-align: center;
}
.btn-primary {
  background-color: #0e1b77;
  color: white;
  border: none;
  padding: 0.7rem 2rem;
  border-radius: 4px;
  cursor: pointer;
}
.btn-primary:hover {
  background-color: #091254;
}
.btn-secondary {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  padding: 0.7rem 2rem;
  border-radius: 4px;
  cursor: pointer;
}
.btn-secondary:hover {
  background-color: #e5e5e5;
}

.webmedio-category-filter-form .category-search {
  display: none !important;
}

/* Zachowaj widoczność pola wyszukiwania w oknie modalnym */
.categories-modal .category-search {
  display: block !important;
  margin-bottom: 1rem;
}


/* Dodatkowe style dla modalu kategorii */

/* Info box zamiast ::before */
.category-info-box {
  padding: 10px 15px;
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 13px;
  text-align: center;
}

/* Zmiana informacji w trybie wyszukiwania */
.categories-modal.search-mode .category-info-box {
  background-color: #fff3cd;
  color: #856404;
  border-color: #ffeaa7;
}

/* Kategorie główne - wyróżnienie */
.categories-modal .category-tree-container > ul > li > .category-item,
.categories-modal .column-split > ul > li > .category-item {
  font-size: 16px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  margin-bottom: 5px;
  padding-left: 15px !important; /* Dodatkowy padding zamiast checkboxa */
}

.categories-modal .category-tree-container > ul > li > .category-item:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

/* Zaznaczona kategoria główna */
.categories-modal .category-tree-container > ul > li > .category-item.selected {
  background-color: #0e1b77;
  color: white;
  border-color: #0e1b77;
  box-shadow: 0 2px 8px rgba(14, 27, 119, 0.3);
}

.categories-modal .category-tree-container > ul > li > .category-item.selected:hover {
  background-color: #091254;
  box-shadow: 0 2px 10px rgba(14, 27, 119, 0.4);
}

/* Podkategorie - mniejsze wcięcie i rozmiar */
.categories-modal .children {
  margin-left: 20px;
  margin-top: 5px;
  border-left: 2px solid #dee2e6;
  padding-left: 10px;
}

.categories-modal .children .category-item {
  font-size: 14px;
  padding: 5px 10px;
  padding-left: 15px !important; /* Dodatkowy padding zamiast checkboxa */
  margin: 2px 0;
}

/* Zaznaczona podkategoria */
.categories-modal .children .category-item.selected {
  background-color: #e0f0ff;
  font-weight: 600;
  color: #0e1b77;
}

/* Ukryj toggle-children w modalu */
.categories-modal .toggle-children {
  display: none !important;
}

/* Kategorie główne z podkategoriami - wskaźnik */
.categories-modal .category-item.has-children::after {
  content: "▶";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.5;
  transition: transform 0.3s;
}

.categories-modal .category-item.has-children.expanded::after {
  transform: translateY(-50%) rotate(90deg);
}

/* Animacja rozwijania */
.categories-modal .children {
  transition: all 0.3s ease;
  overflow: hidden;
}

.categories-modal .children.hidden {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.categories-modal .children.show {
  max-height: 1000px;
  opacity: 1;
}

/* Ukryj punktory listy */
.categories-modal ul {
  list-style: none !important;
  padding-left: 0;
}

.categories-modal li {
  list-style: none !important;
}

/* Wcięcia dla struktury drzewa */
.categories-modal .children ul {
  padding-left: 20px;
}

/* Kursor dla kategorii */
.categories-modal .category-item {
  cursor: pointer;
  user-select: none;
}

/* Przycisk zamknięcia X */
.close-modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
  color: #666;
  z-index: 10;
}

.close-modal-x:hover {
  color: #000;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

/* Responsywność modalu */
@media (max-width: 768px) {
  .categories-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .categories-modal .children {
    margin-left: 15px;
    padding-left: 8px;
  }
}

.categories-section {
  position: relative;
  padding: 40px 0;

// Nagłówek sekcji z przyciskiem
.categories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 0 15px;

  @media (max-width: 768px) {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
  }
}
}
.main-categories-fullwidth {
  padding: 40px 0;
  background-color: #f8f9fa;

  .container {
    position: relative;
  }
}

.all-categories-button-wrapper {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 20px;
  padding: 0 50px;

  @media (max-width: 992px) {
    padding: 0 45px;
  }

  @media (max-width: 768px) {
    padding: 0 40px;
    margin-bottom: 16px;
    justify-content: center;
  }
}

.all-categories-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: #ffffff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  line-height: 1;

  &:focus {
    outline: none;
  }

  svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
  }

  span {
    position: relative;
    z-index: 1;
  }

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(14, 27, 119, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
  }

  &:hover {
    background-color: #f8f8f8;
    border-color: #0e1b77;
    color: #0e1b77;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 27, 119, 0.15);

    &::before {
      opacity: 1;
    }

    svg {
      transform: rotate(45deg);
      stroke: #0e1b77;
    }
  }

  &:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(14, 27, 119, 0.1);
  }

  &:disabled,
  &.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
  }
}

.main-categories-carousel-container {
  position: relative;
  overflow: visible;
  padding: 0 50px;

  .main-categories-carousel {
    .main-category-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px 16px;
      background: #ffffff;
      border: 2px solid #e5e7eb;
      border-radius: 12px;
      text-decoration: none;
      transition: all 0.3s ease;
      height: 100%;
      min-height: 120px;
      text-align: center;

      .main-category-name {
        font-size: 16px;
        font-weight: 600;
        color: #1a1a1a;
        margin-bottom: 8px;
        line-height: 1.2;
      }

      .main-category-count {
        font-size: 14px;
        color: #6b7280;
      }

      &:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
        border-color: #0e1b77;

        .main-category-name {
          color: #0e1b77;
        }
      }

      &.active {
        background-color: #0e1b77;
        border-color: #0e1b77;

        .main-category-name {
          color: #ffffff;
        }

        .main-category-count {
          color: rgba(255, 255, 255, 0.8);
        }
      }
    }
  }

  .carousel-prev,
  .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    font-size: 18px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

    &:hover:not(.disabled) {
      background-color: #0e1b77;
      color: white;
      border-color: #0e1b77;
      box-shadow: 0 4px 12px rgba(14, 27, 119, 0.2);
    }

    &.disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  .carousel-prev {
    left: 0;
  }

  .carousel-next {
    right: 0;
  }

  .carousel-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;

    .pagination-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background-color: #d1d5db;
      border: none;
      cursor: pointer;
      transition: all 0.3s ease;
      padding: 0;

      &:hover {
        background-color: #9ca3af;
      }

      &.active {
        background-color: #0e1b77;
        width: 24px;
        border-radius: 4px;
      }
    }
  }
}

@media (max-width: 992px) {
  .main-categories-fullwidth {
    padding: 30px 0;
  }

  .main-categories-carousel-container {
    padding: 0 45px;

    .carousel-prev {
      left: 0;
    }

    .carousel-next {
      right: 0;
    }
  }
}

@media (max-width: 768px) {
  .all-categories-button-wrapper {
    margin-bottom: 16px;
    justify-content: center;
  }

  .all-categories-button {
    width: 100%;
    max-width: 300px;
    justify-content: center;
    padding: 14px 24px;
  }

  .main-categories-carousel-container {
    padding: 0 40px;

    .carousel-prev,
    .carousel-next {
      width: 35px;
      height: 35px;
      font-size: 16px;
    }

    .carousel-prev {
      left: 0;
    }

    .carousel-next {
      right: 0;
    }
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.all-categories-button-wrapper {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.main-categories-carousel li {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;

  @for $i from 1 through 10 {
    &:nth-child(#{$i}) {
      animation-delay: #{$i * 0.1 + 0.2}s;
    }
  }
}
