.category-ajax-search {
    position: relative;
    margin: 20px 0;
    max-width: 500px;
    width: 100%;
    transition: all 0.3s ease-in-out;
}

.category-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px; 
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 0px !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="%23999" d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
}

.category-search-input:focus {
    border-color: #ddd;
    outline: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.category-search-input::placeholder {
    color: #999;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 15px 15px;
    max-height: 500px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    margin-top: 5px;
}

.results-count {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #666;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-results {
    cursor: pointer;
    font-size: 18px;
    color: #666;
    padding: 0 5px;
}

.close-results:hover {
    color: #f5ad0d;
}

.search-result-item {
    display: flex;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
    align-items: flex-start;
    background: #fff;
}

.search-result-item:hover {
    background: #fffdf6;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.active {
    background: #fff9e6;
    border-left: 3px solid #f5ad0d;
}

.result-image {
    flex: 0 0 40px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}

.no-image {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ccc;
    border: 1px solid #eee;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.3;
    word-wrap: break-word;
}

.result-meta {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.meta-item {
    font-size: 11px;
    color: #666;
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    white-space: nowrap;
}

.meta-item.hidden {
    display: none;
}

.result-price {
    font-weight: 700;
    color: #f5ad0d;
    font-size: 14px;
}

.result-actions {
    flex: 0 0 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-left: 10px;
}

.quick-view-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}


.search-loading,
.search-no-results,
.search-error {
    padding: 20px;
    text-align: left;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
}

.search-loading {
    color: #f5ad0d;
    font-weight: 600;
}

/* Полоса прокрутки */
.search-results::-webkit-scrollbar {
    width: 2px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 15px 0;
}

.search-results::-webkit-scrollbar-thumb {
    background: #f5ad0d;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #e59c00;
}

/* Сдвигаем полосу прокрутки вниз */
.search-results::-webkit-scrollbar-track {
    margin-top: 48px;
}

.search-results::-webkit-scrollbar-thumb {
    margin-top: 48px;
}

/* Мобильные стили */
@media (max-width: 767px) {
    .category-ajax-search {
        max-width: 100%;
        margin: 0;
    }
    
    .search-results {
        max-height: 60vh;
    }
    
    .result-title {
        font-size: 13px;
    }
    
    .meta-item {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .category-search-input {
        font-size: 15px !important;
        padding: 12px 40px 12px 15px;
    }
    
    /* Скрываем крестик в результатах на мобильных */
    .results-count .close-results {
        display: none;
    }
    
    /* Адаптация для мобильных */
    .result-actions {
        flex: 0 0 35px;
        margin-left: 8px;
    }
    
    .quick-view-btn {
        width: 35px;
        height: 35px;
    }
    
    .result-image {
        flex: 0 0 35px;
    }
    
    .result-image img {
        width: 35px;
        height: 35px;
    }
    
    .no-image {
        width: 35px;
        height: 35px;
    }

    .search-results::-webkit-scrollbar-track {
        margin-top: 40px !important;
    }

    .search-results::-webkit-scrollbar-thumb {
        margin-top: 40px !important;
    }
}

/* Анимации */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results {
    animation: slideDown 0.3s ease;
}

.search-result-item {
    animation: slideDown 0.2s ease;
}

/* Стили для мобильного полноэкранного режима */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgb(255 255 255);
    z-index: 9997;
    display: none;
}

.mobile-search-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    background: white;
    margin: 0 !important;
    padding: 10px;
    box-sizing: border-box;
    transition: all 0.3s ease-in-out;
}

.mobile-search-active .category-search-input {
    background-image: none !important;
    padding-right: 45px;
    border-radius: 0px;
    border: 1px solid #ddd;
    margin-bottom: 0px;
}

.mobile-close-btn {
    position: absolute;
    right: 25px;
    top: 40px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.mobile-search-active .mobile-close-btn {
    display: flex;
    padding: 0px;
}

.mobile-close-btn:hover {
    color: #f5ad0d;
    background: none;
}

.mobile-search-active .search-results {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-height: none !important;
    border-radius: 10px;
    margin-top: 0;
}



/* Стили для фильтра категорий */
.category-filter {
    display: flex;
    align-items: center;
    margin-top: 12px;
    padding: 0 15px;
    font-size: 14px;
    font-family: "Roboto", sans-serif;
}

.filter-label {
    margin-right: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    font-family: "Roboto", sans-serif;
}

.filter-toggle:hover {
    color: #f5ad0d;
}

.filter-current {
    font-weight: 400;
    font-size: 14px;
}

.filter-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.3s ease;
    margin-left: 2px;
}

.filter-options.active + .filter-toggle .filter-arrow {
    transform: rotate(180deg);
}

.filter-options {
    position: absolute;
    top: 100%;
    left: -12px;
    min-width: 250px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 10px;
}

.filter-options.active {
    display: block;
}

.filter-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #333;
}

.filter-option:hover {
    background-color: #f8f9fa;
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option.current-category {
 background-color: #ffffff;
    color: #f9b111;
    font-weight: 500;
}

/* Полоса прокрутки для выпадающего списка */
.filter-options::-webkit-scrollbar {
    width: 2px;
}

.filter-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.filter-options::-webkit-scrollbar-thumb {
    background: #f5ad0d;
    border-radius: 3px;
}

.filter-options::-webkit-scrollbar-thumb:hover {
    background: #e59c00;
}

/* Мобильные стили для фильтра */
@media (max-width: 767px) {
    .category-filter {
        font-size: 13px;
        padding: 0 15px;
    }
    
    .filter-toggle {
        font-size: 13px;
    }
    
    .filter-option {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .filter-options {
        min-width: 230px;
    }
}

/* Специфические стили чтобы перебить общие стили кнопок */
.category-ajax-search .filter-toggle {
    font-family: "Roboto", sans-serif !important;
    font-size: 14px !important;
    color: #333 !important;
    background-color: transparent !important;
    display: inline-flex !important;
    font-weight: 500 !important;
    height: auto !important;
    line-height: normal !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    -webkit-appearance: none !important;
    transition: all ease 0.3s !important;
    white-space: nowrap !important;
}

.category-ajax-search .filter-toggle:hover {
    color: #f5ad0d !important;
    background-color: transparent !important;
    border: none !important;
}



.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-submit-btn {
    position: absolute;
    right: 10px;
    background-color: transparent !important;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-submit-btn:hover svg path {
    fill: #f5ad0d;

}


/* Для мобильных устройств */
@media (max-width: 767px) {
    .mobile-search-active .search-submit-btn {
        right: 50px; /* Сдвигаем кнопку, чтобы не пересекалась с крестиком */
display:none;
    }

.category-search-input {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="%23999" d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') !important;
        background-repeat: no-repeat;
        background-position: right 15px center;
        background-size: 20px;
    }
}
