/* catalog-products.css - ОПТИМИЗИРОВАННАЯ ВЕРСИЯ */

/* СЕТКА */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.products-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* КАРТОЧКА */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* БЕЙДЖИ */
.product-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #e53e3e;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
}

/* ИЗОБРАЖЕНИЕ */
.product-image-container {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* КОНТЕНТ */
.product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ЗАГОЛОВКИ */
.product-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    height: 2.8rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #2e7d32;
}

.product-code {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 0.5rem;
}

/* ОПИСАНИЕ */
.product-description-short {
    color: #64748b;
    line-height: 1.4;
    font-size: 0.9rem;
    max-height: 2.8rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ЦЕНЫ */
.product-price {
    margin: 1rem 0;
}

.price-discount-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    animation: slideInUp 0.4s ease-out;
}

.current-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2e7d32;
    line-height: 1;
}

.current-price.discounted {
    color: #e53e3e;
    font-weight: 800;
    animation: text-pulse 2s ease-in-out infinite;
}

.old-price {
    font-size: 0.85rem;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 500;
}

.discount-badge {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    align-self: flex-start;
    margin-top: 0.25rem;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
    position: relative;
    overflow: hidden;
}

.discount-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

/* РЕЙТИНГ */
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.rating-stars {
    display: flex;
    gap: 0.1rem;
}

.rating-stars .fas {
    font-size: 0.8rem;
    color: #ffd700;
}

.rating-text {
    font-size: 0.8rem;
    color: #718096;
}

/* КНОПКИ */
.product-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.btn-modern {
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
    color: white;
}

.product-actions-list .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.product-actions-list .btn:hover {
    transform: translateY(-1px);
}

/* РЕЖИМ СПИСКА */
.products-grid.view-list .product-card {
    flex-direction: row;
    height: auto;
    padding: 1.5rem;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid #e9ecef;
}

.products-grid.view-list .product-card:hover {
    background: #f8f9fa;
    transform: none;
}

.products-grid.view-list .product-card:nth-child(even) {
    background: #f8f9fa;
}

.products-grid.view-list .product-image-container {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    margin-right: 1.5rem;
    margin-bottom: 0;
}

.products-grid.view-list .product-content {
    flex: 1;
    padding: 0;
    justify-content: center;
}

.products-grid.view-list .product-title {
    font-size: 1.2rem;
    height: auto;
    -webkit-line-clamp: unset;
}

.products-grid.view-list .product-price {
    margin: 0;
    text-align: right;
    padding-left: 1rem;
}

.products-grid.view-list .price-discount-wrapper {
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 0.25rem;
}

.products-grid.view-list .current-price {
    font-size: 1.3rem;
}

.products-grid.view-list .old-price {
    font-size: 0.9rem;
}

.products-grid.view-list .discount-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    margin-top: 0.25rem;
}

.products-grid.view-list .product-actions {
    width: 200px;
    flex-shrink: 0;
    border-top: none;
    border-left: 1px solid #e9ecef;
    padding: 0 0 0 1.5rem;
    margin-left: 1.5rem;
    margin-top: 0;
    display: flex;
    align-items: center;
}

/* ПОИСК */
.search-header-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.catalog-search-form {
    max-width: 100%;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.search-icon {
    padding: 0 1rem;
    color: #6c757d;
    font-size: 1.1rem;
}

.search-field-wrapper {
    flex: 1;
    margin: 0;
}

.search-input {
    border: none !important;
    box-shadow: none !important;
    font-size: 1.1rem;
    padding: 0.75rem 0;
}

.search-input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.search-submit-btn {
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
    color: white;
}

.search-results-info {
    text-align: center;
    padding: 2rem 0;
}

.search-query-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.search-stats {
    font-size: 1.1rem;
    color: #718096;
}

.empty-search-state {
    padding: 4rem 2rem;
}

.empty-search-icon {
    opacity: 0.7;
}

.search-tips {
    max-width: 400px;
    margin: 0 auto;
}

.tips-list {
    text-align: left;
}

.tip-item {
    padding: 0.5rem 0;
    color: #64748b;
}

.search-filters .filter-option {
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 0.25rem;
}

.search-filters .filter-option:hover {
    background: #f8f9fa;
}

.filter-label-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
    margin: 0;
}

.filter-btn-reset {
    background: #6c757d;
    color: white;
}

.filter-btn-reset:hover {
    background: #5a6268;
    color: white;
}

/* АНИМАЦИИ */
@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes text-pulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(229, 62, 62, 0);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 0 10px rgba(229, 62, 62, 0.6);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* АДАПТИВ */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .product-card {
        padding: 1rem;
    }

    .product-image-container {
        height: 160px;
    }

    .product-title {
        font-size: 1rem;
        height: 2.6rem;
    }

    .current-price {
        font-size: 1.2rem;
    }

    /* Режим списка на мобильных */
    .products-grid.view-list .product-card {
        flex-direction: column;
        padding: 1.5rem;
        border-radius: 8px;
        margin-bottom: 1rem;
        border: 1px solid #e9ecef;
    }

    .products-grid.view-list .product-image-container {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .products-grid.view-list .product-title {
        font-size: 1.1rem;
    }

    .products-grid.view-list .product-price {
        text-align: left;
        padding-left: 0;
        margin-bottom: 1rem;
    }

    .products-grid.view-list .price-discount-wrapper {
        align-items: flex-start;
    }

    .products-grid.view-list .current-price {
        font-size: 1.3rem;
    }

    .products-grid.view-list .product-actions {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e9ecef;
        padding: 1rem 0 0 0;
        margin-left: 0;
        margin-top: 1rem;
    }

    .product-actions-list {
        display: flex;
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .product-actions-list .btn {
        flex: 1;
        margin-bottom: 0;
    }

    /* Поиск на мобильных */
    .search-header-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .search-input-group {
        flex-direction: column;
        gap: 1rem;
    }

    .search-icon {
        display: none;
    }

    .search-field-wrapper {
        width: 100%;
    }

    .search-input {
        text-align: center;
    }

    .search-submit-btn {
        width: 100%;
    }

    .search-query-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .product-card {
        padding: 0.75rem;
    }
}

/* ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ */
.products-grid-wrapper {
    position: relative;
    min-height: 400px;
}

.pagination-section {
    position: relative;
    z-index: 5;
}