/* ---------- Контейнери верхнього контролу (пошук + сортування) ---------- */
.taxonomy-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Білий блок навколо пошуку */
.taxonomy-search-wrapper {
    flex: 1 1 320px;
    min-width: 200px;
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* сам інпут */
.taxonomy-search {
    position: relative;
    width: 100%;
}
.taxonomy-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff1f30;
    font-size: 18px;
}
.taxonomy-search input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    font-size: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.taxonomy-search input:hover,
.taxonomy-search input:focus {
    box-shadow: 0 6px 18px rgb(52 47 47 / 21%);
    border-color: rgb(50 44 45 / 15%);
    outline: none;
}

/* ---------- Сортування (кастомний dropdown) ---------- */
.taxonomy-sort-wrapper {
    flex: 0 0 200px;
    min-width: 180px;
    background: #fff;
    padding: 13px 20px 13px 54px;
    border-radius: 8px;
    box-shadow: 0 2px 22px rgba(40,40,40,0.09);
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
    outline: none;
}

.taxonomy-sort-wrapper .sort-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff1f30;
    font-size: 22px;
    pointer-events: none;
    z-index: 2;
}

.dropdown-selected {
    font-size: 14px;
    color: #222;
    border-radius: 8px;
    padding: 9px 46px 9px 0;
    width: 100%;
    position: relative;
    cursor: pointer;
    user-select: none;
}
.dropdown-selected:focus {
    outline: none;
    box-shadow: 0 6px 12px rgba(52,47,47,0.17);
    background: #ebecf0;
    border: 1px solid #ff1f30;
}

/* Кастомна стрілка */
.dropdown-selected::after {
    content:'';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #ff1f30;
    z-index: 1;
}

.dropdown-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 54px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(30,30,40,0.09);
    z-index: 10;
    transition: opacity 0.22s ease, transform 0.22s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    overflow: hidden;
    max-height: 220px;
    overflow-y: auto;
}

.taxonomy-sort-wrapper.open .dropdown-list {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.dropdown-option {
    padding: 14px 28px;
    font-size: 14px;
    color: #222;
    cursor: pointer;
    transition: background 0.18s ease;
    user-select: none;
}
.dropdown-option:hover,
.dropdown-option.active {
    background: #e9e9e96b;
    color: #ff1f30;
}

/* ---------- GRID ---------- */
.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 18px;
    transition: min-height 0.3s;
}

/* item */
.taxonomy-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    border: 1px solid #eee;
    padding: 12px;
    border-radius: 8px;
    background: #fff;
    transition: transform 0.28s ease, box-shadow 0.28s ease, opacity 0.28s ease;
    min-height: 180px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(8px);
}
.taxonomy-item.visible {
    opacity: 1;
    transform: translateY(0);
}
.taxonomy-item:hover {
    box-shadow: 0 8px 26px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}
.taxonomy-item-img-wrap {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.taxonomy-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.taxonomy-item-title {
    display: block;
    padding: 6px 4px 0;
    font-weight: 600;
    color: #222;
    line-height: 1.2;
}
.taxonomy-no-results {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 18px;
    padding: 20px;
}
.taxonomy-loading {
    text-align: center;
    padding: 14px 0;
    color: #666;
}
/* адаптив */
@media (max-width: 1200px) {
    .taxonomy-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 992px) {
    .taxonomy-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .taxonomy-controls { gap: 10px; }
    .taxonomy-search-wrapper { flex: 1 1 60%; }
    .taxonomy-sort-wrapper { flex: 0 0 36%; min-width: 140px; }
    .taxonomy-grid { grid-template-columns: repeat(3, 1fr); }
    .taxonomy-item-img-wrap { height: 90px; }
}
@media (max-width: 480px) {
    .taxonomy-search-wrapper { padding: 10px; }
    .taxonomy-search input { padding: 8px 10px 8px 36px; }
    .taxonomy-grid { gap: 12px; }
}
/* Мобільна адаптація для кастомного dropdown */
@media (max-width: 768px) {
    .custom-dropdown { min-width: 100%; padding: 9px 14px 9px 40px; }
    .dropdown-selected { font-size: 14px; padding-right: 36px; }
    .dropdown-selected::after { right: 12px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 8px solid #ff1f30;}
    .dropdown-option { padding: 13px 17px; font-size: 15px; }
    .custom-dropdown .sort-icon { left: 14px; font-size: 20px; }
}
