/* === ОСНОВНАЯ СТРУКТУРА === */
.discount-products-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.discount-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 10px;
}

.products-count .count-text {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.products-sorting {
    min-width: 220px;
}

.sort-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: #F58B04;
}

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.discount-main-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

/* === ФИЛЬТРЫ === */
.discount-filters-sidebar {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.discount-filters-sidebar::-webkit-scrollbar {
    width: 4px;
}

.discount-filters-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.discount-filters-sidebar::-webkit-scrollbar-thumb {
    background: #F58B04;
    border-radius: 2px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 3px solid #F58B04;
    padding-bottom: 15px;
}

.filters-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #333;
}

.clear-filters {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.clear-filters:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

/* Стили для подкатегорий */
.category-item {
    margin-bottom: 5px;
}

.category-parent {
    font-weight: 600;
    position: relative;
    padding-right: 25px;
}

.toggle-subcategories {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    color: #666;
}

.toggle-subcategories.open {
    transform: translateY(-50%) rotate(90deg);
}

.subcategories {
    margin-left: 20px;
    border-left: 2px solid #F58B04;
    padding-left: 10px;
    margin-top: 5px;
    margin-bottom: 10px;
}

.subcategory {
    font-weight: normal;
    font-size: 0.85rem;
}

/* Поиск в фильтрах */
.filter-search {
    margin-bottom: 10px;
}

.filter-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-search-input:focus {
    outline: none;
    border-color: #F58B04;
    box-shadow: 0 0 0 3px rgba(245, 139, 4, 0.1);
}

.filter-search-input:hover {
    border-color: #F58B04;
}

/* Чекбоксы */
.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    width: 100%;
}

.filter-checkbox:hover {
    color: #F58B04;
}

.filter-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #F58B04;
    flex-shrink: 0;
}

.count {
    margin-left: auto;
    color: #999;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.filter-scroll {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 8px;
}

.filter-scroll::-webkit-scrollbar {
    width: 4px;
}

.filter-scroll::-webkit-scrollbar-track {
    background: #f9f9f9;
}

.filter-scroll::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* Фильтр цены */
.price-filter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.price-inputs input {
    width: 45%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.price-inputs input:hover {
    border-color: #F58B04;
}

.price-inputs input:focus {
    outline: none;
    border-color: #F58B04;
    box-shadow: 0 0 0 3px rgba(245, 139, 4, 0.1);
}

.price-inputs span {
    color: #999;
    flex-shrink: 0;
}

.price-apply {
    background: linear-gradient(135deg, #F58B04 0%, #FF9A00 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 2px 8px rgba(245, 139, 4, 0.3);
}

.price-apply:hover {
    background: linear-gradient(135deg, #535353 0%, #6A6A6A 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(83, 83, 83, 0.4);
}

.price-apply:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(83, 83, 83, 0.3);
}

/* === ВЕРТИКАЛЬНЫЕ КАРТОЧКИ ТОВАРОВ === */
.discount-grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

.discount-card-h {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 420px;
    min-height: 420px;
}

.discount-card-h:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

/* КАРТИНКА СВЕРХУ */
.discount-thumb {
    position: relative;
    height: 180px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.discount-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
    padding: 20px;
}

.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #F58B04;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 8px;
    z-index: 10;
}

/* ТЕЛО КАРТОЧКИ */
.discount-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    height: 240px;
    min-height: 240px;
}

/* НАЗВАНИЕ */
.discount-title {
    font-size: 1.05rem;
    line-height: 1.4;
    color: #333;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.8em;
    font-weight: 500;
    text-align: left;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
}

.discount-title strong {
    color: #000;
    font-weight: 600;
    display: block;
}

/* МЕТА-ИНФОРМАЦИЯ */
.discount-meta {
    margin-bottom: 15px;
}

.discount-store, .discount-brand {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.3;
    margin-bottom: 3px;
    text-align: left;
}

/* ЦЕНЫ */
.discount-prices {
    margin: 15px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
}

.new-price {
    color: #F58B04;
    font-weight: 700;
    font-size: 1.3rem;
}

/* КНОПКА */
.discount-btn {
    display: block;
    background: linear-gradient(135deg, #F58B04 0%, #FF9A00 100%);
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    width: 100%;
    margin-top: auto;
    box-shadow: 0 4px 15px rgba(245, 139, 4, 0.3);
}

.discount-btn:hover {
    background: linear-gradient(135deg, #535353 0%, #6A6A6A 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(83, 83, 83, 0.4);
    color: #fff;
}

/* ЗАГРУЗКА */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 16px;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #F58B04;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.discount-grid-container {
    min-height: 400px;
}

/* ПАГИНАЦИЯ */
.discount-pagination {
    text-align: center;
    margin-top: 40px;
}

.page-numbers {
    display: inline-flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-numbers li {
    margin: 0;
}

.page-numbers a,
.page-numbers span {
    display: inline-block;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    font-size: 1rem;
    min-width: 50px;
}

.page-numbers a:hover,
.page-numbers .current {
    background: #F58B04;
    color: white;
    border-color: #F58B04;
    transform: translateY(-2px);
}

.no-products {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

.debug-info {
    font-size: 0.7rem;
    color: #999;
    font-style: italic;
    margin-top: 5px;
}

/* АДАПТИВ */
@media (max-width: 1200px) {
    .discount-grid3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .discount-card-h {
        height: 400px;
        min-height: 400px;
    }
}

@media (max-width: 992px) {
    .discount-main-container {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .discount-filters-sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .discount-grid3 {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .discount-card-h {
        height: 380px;
        min-height: 380px;
    }
    
    .discount-thumb {
        height: 160px;
    }
    
    .discount-body {
        height: 220px;
        min-height: 220px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .discount-products-wrapper {
        padding: 15px;
    }
    
    .discount-card-h {
        height: 360px;
        min-height: 360px;
    }
    
    .discount-thumb {
        height: 140px;
    }
    
    .discount-body {
        height: 200px;
        min-height: 200px;
        padding: 12px;
    }
    
    .discount-title {
        font-size: 1rem;
        -webkit-line-clamp: 4;
    }
}
