/* Стили левой колонки (фильтры и поиск) */
.sidebar {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
    height: fit-content;
    z-index: 10;
}
/* Поисковая строка */
.search-box {
    position: relative;
    margin-bottom: 20px;
    width: 100%; /* Гарантируем, что не выйдет за пределы */
}
.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    outline: none;
    box-sizing: border-box; /* Учитываем padding в ширине */
}
.search-box input:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}
#clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #888;
    font-weight: bold;
    display: none;
}
#clear-search:hover {
    color: #d90429;
}
.search-box input:not(:placeholder-shown) + #clear-search {
    display: block;
}
/* Фильтры внутри сайдбара */
#filters {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
#filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-weight: bold;
}

#filters .color-palette-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    font-weight: bold;
    color: rgb(51, 51, 51);
    border-bottom: 1px solid #eee;
}

#filters .color-palette-toggle:hover {
    color: rgb(67, 97, 238);
}

.toggle-icon {
    font-weight: bold;
    transition: transform 0.3s;
}

.toggle-icon.open {
    transform: rotate(45deg);
}

#filters select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 100%;
    box-sizing: border-box;
}
/*grespoyer is perfect*/
/* Стили для слайдера цены */
.price-range-container {
    width: 100%;
    margin-top: 0px;
    position: relative;
    padding: 0px 0;
}
.price-range-slider {
    position: relative;
    height: 24px;
    width: 98%;
    margin: 20px 0;
    margin-left: 3px;
    touch-action: none;
}
.price-range-values {
    text-align: center;
    font-size: 16px;
    color: rgb(67, 97, 238);
    font-weight: bold;
    margin-top: 10px;
}
.price-range-values span {
    font-weight: bold;
    color: #4361ee;
}
.slider-track {
    position: absolute;
    height: 6px;
    width: 100%;
    background: #e9ecef;
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
}
.slider-range {
    position: absolute;
    height: 6px;
    background: #4361ee;
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}
/* Измененные стили для ползунков - толстые палочки вместо кругов */
.slider-thumb {
    position: absolute;
    width: 6px; /* Тонкий по ширине */
    height: 24px; /* Высокий - как палочка */
    background: rgb(67, 97, 238);
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.slider-thumb::before,
.slider-thumb::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 4px;
    background: rgb(67, 97, 238);
}
.slider-thumb::before {
    top: 0px; /* Верхняя "крышечка" */
}
.slider-thumb::after {
    bottom: 0px; /* Нижняя "крышечка" */
}
.slider-thumb.active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}
/* Измененные стили для tooltip - теперь позиционируется точно над ползунком */
.slider-tooltip {
    position: absolute;
    background: rgb(67, 97, 238);
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: bold;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.slider-tooltip.visible {
    opacity: 1;
}
/* Сдвигаем шапочки, чтобы они выглядели как [ ] */
.slider-thumb.min-thumb::before {
    left: 6px; /* Сдвигаем внутрь */
}

.slider-thumb.min-thumb::after {
    left: 6px; /* Сдвигаем внутрь */
}

.slider-thumb.max-thumb::before {
    right: -6px; /* Сдвигаем внутрь */
    left: auto;
}

.slider-thumb.max-thumb::after {
    right: -6px; /* Сдвигаем внутрь */
    left: auto;
}
/* Блок управления пагинацией */
.pagination-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.pagination-controls label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.pagination-controls select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}
/* Переключатель режима отображения */
.view-mode-toggle {
    display: flex;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}
.view-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
}
.view-btn.active {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}
.view-btn:hover:not(.active) {
    background: #e9ecef;
}


/* Панель выбора цвета */
.color-palette-panel {
    position: fixed;
    top: 20px;
    left: calc(250px + 20px); /* Ширина сайдбара + отступ */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 15px;
    width: 450px;
    max-height: 90vh;
    overflow: auto;
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(10px);
    opacity: 1;
}

.color-palette-panel.hidden {
    transform: translateX(-20px);
    opacity: 0;
    pointer-events: none;
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.close-palette {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #6c757d;
}

.close-palette:hover {
    color: #d90429;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(6, 70px);
    gap: 8px;
    justify-content: center;
}

.color-item {
    width: 70px;
    height: 70px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-item:hover {
    transform: scale(1.05);
    border-color: #4361ee;
}
.color-item.selected {
    border-color: #4361ee; /* Синий цвет вместо оранжевого */
    box-shadow: 0 0 0 2px #4361ee;
    transform: scale(1.05); /* Добавляем небольшое увеличение как при наведении */
}

.color-item.unavailable-color {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.color-item.unavailable-color::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 80%;
    height: 2px;
    background: #d90429;
    opacity: 0.7;
}

.color-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.color-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 12px;
    padding: 3px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.color-item:hover .color-label {
    opacity: 1;
}
.detailed-view-toggle {
    margin: 10px 0;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}
.detailed-view-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}
.detailed-view-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
/*grespoyer */
/* Стили для отмены выбранного цвета */
.color-item.selected:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(67, 97, 238, 0.5); /* Синий с 50% прозрачностью */
    z-index: 2;
    border-radius: 4px;
}

.color-item.selected:hover::after {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    z-index: 3;
}

/* Стили для курсора при наведении на выбранный цвет */
.color-item.selected:hover {
    cursor: pointer;
}
.no-colors-message {
    grid-column: span 6;
    font-size: 16px;
}