/**
 * Каталог товаров - ГАРАНТИРОВАННО РАБОЧАЯ ВЕРСИЯ
 * Все стили с !important для переопределения WooCommerce
 */

/* ========================================
   СТРУКТУРА КАТАЛОГА
   ======================================== */

.container-catalog {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 40px 20px !important;
}

.shop-content-wrapper {
    display: grid !important;
    grid-template-columns: 250px 1fr !important;
    gap: 32px !important;
}

/* Sidebar */
.shop-sidebar {
    position: sticky !important;
    top: 100px !important;
    height: fit-content !important;
}

.sidebar-inner {
    background: #ffffff !important;
    padding: 24px !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

.sidebar-title {
    font-size: 18px !important;
    font-weight: 700 !important;
    margin-bottom: 20px !important;
    color: #111827 !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid #2563eb !important;
}

/* Категории */
.category-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.category-list li {
    margin-bottom: 8px !important;
}

.category-list a {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 16px !important;
    color: #4b5563 !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
}

.category-list a:hover,
.category-list a.active {
    background: linear-gradient(145deg, #dbeafe, #dbeafe) !important;
    color: #2563eb !important;
}

.category-list .count {
    font-size: 13px !important;
    color: #9ca3af !important;
    background: #f3f4f6 !important;
    padding: 2px 10px !important;
    border-radius: 12px !important;
}

/* ========================================
   ОСНОВНАЯ ЧАСТЬ
   ======================================== */

.shop-main {
    min-width: 0 !important;
}

/* Toolbar */
.shop-toolbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 24px !important;
    padding: 16px 20px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05) !important;
}

.woocommerce-result-count {
    color: #6b7280 !important;
    font-size: 14px !important;
}

.shop-ordering {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.shop-ordering label {
    color: #6b7280 !important;
    font-size: 14px !important;
}

.shop-ordering select {
    padding: 8px 16px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    color: #4b5563 !important;
    background: #ffffff !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease !important;
}

.shop-ordering select:focus {
    outline: none !important;
    border-color: #2563eb !important;
}

/* ========================================
   СЕТКА ТОВАРОВ - ГАРАНТИЯ
   ======================================== */

.woocommerce ul.products,
.woocommerce-page ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* 4 колонки на больших экранах */
@media (min-width: 1200px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* 2 колонки на планшетах */
@media (max-width: 1024px) {
    .shop-content-wrapper {
        grid-template-columns: 1fr !important;
    }
    
    .shop-sidebar {
        position: static !important;
        margin-bottom: 24px !important;
    }
    
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* 1 колонка на мобильных */
@media (max-width: 640px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: 1fr !important;
    }
    
    .shop-toolbar {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
    }
}

/* ========================================
   КАРТОЧКА ТОВАРА - ИДЕАЛЬНАЯ
   ======================================== */

/* Сброс WooCommerce классов first/last */
.woocommerce ul.products li.product.first,
.woocommerce ul.products li.product.last,
.woocommerce ul.products li.product {
    margin-left: 0 !important;
    margin-right: 0 !important;
    clear: none !important;
    width: 100% !important;
    float: none !important;
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.product-card {
    background: #ffffff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid #f3f4f6 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.woocommerce ul.products li.product:hover,
.product-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

/* Внутренняя обёртка */
.product-inner {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ссылка на изображение */
.product-image-link {
    display: block !important;
    width: 100% !important;
    text-decoration: none !important;
    color: inherit !important;
}

/* Изображение */
.product-image-wrapper {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    background: #f9fafb !important;
}

.product-image-wrapper img,
.product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease !important;
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.08) !important;
}

/* Бейдж */
.product-badge {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    padding: 6px 12px !important;
    background: linear-gradient(145deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    border-radius: 20px !important;
    z-index: 2 !important;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3) !important;
}

/* Детали товара */
.product-details {
    padding: 16px !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

/* Категория */
.product-category {
    display: inline-block !important;
    font-size: 12px !important;
    color: #2563eb !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
}

/* Название */
.product-name,
.product-title,
.woocommerce-loop-product__title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 44px !important;
}

.product-name a,
.product-title a {
    color: inherit !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.product-name a:hover,
.product-title a:hover {
    color: #2563eb !important;
}

/* Рейтинг */
.product-rating-wrapper {
    margin-bottom: 4px !important;
}

.woocommerce .star-rating {
    font-size: 14px !important;
    color: #fbbf24 !important;
    float: none !important;
    margin: 0 !important;
}

/* Цена */
.product-price-wrapper,
.product-price {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
    flex-wrap: wrap !important;
}

.old-price {
    font-size: 14px !important;
    color: #9ca3af !important;
    text-decoration: line-through !important;
}

.current-price,
.price {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #2563eb !important;
    padding: 0 !important;
    margin: 0 !important;
}

.current-price .amount,
.price .amount {
    color: inherit !important;
}

/* Кнопки */
.add-to-cart-button,
.view-details-button,
.add_to_cart_button,
.button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 12px 16px !important;
    background: linear-gradient(145deg, #2563eb, #2563eb) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

.product-card-footer-refined {
    display: grid !important;
    gap: 10px !important;
    margin-top: 4px !important;
}

.product-secondary-action {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 44px !important;
    padding: 11px 14px !important;
    border: 1px solid rgba(234, 88, 12, 0.24) !important;
    border-radius: 8px !important;
    background: rgba(255, 247, 237, 0.9) !important;
    color: #1d4ed8 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.add-to-cart-button:hover,
.view-details-button:hover {
    background: linear-gradient(145deg, #2563eb, #1d4ed8) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3) !important;
}

.product-secondary-action:hover {
    background: #dbeafe !important;
    border-color: rgba(194, 65, 12, 0.4) !important;
    transform: translateY(-1px) !important;
}

.add-to-cart-button svg {
    flex-shrink: 0 !important;
}

/* ========================================
   ПАГИНАЦИЯ
   ======================================== */

.woocommerce-pagination {
    margin-top: 40px !important;
}

.woocommerce-pagination ul {
    display: flex !important;
    justify-content: center !important;
    gap: 8px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.woocommerce-pagination ul li {
    display: inline-block !important;
}

.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 12px !important;
    background: #ffffff !important;
    color: #4b5563 !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

.woocommerce-pagination ul li .current,
.woocommerce-pagination ul li a:hover {
    background: linear-gradient(145deg, #2563eb, #2563eb) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3) !important;
}

/* ========================================
   НЕТ ТОВАРОВ
   ======================================== */

.no-products {
    text-align: center !important;
    padding: 60px 20px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
}

.no-products h2 {
    font-size: 24px !important;
    color: #111827 !important;
    margin-bottom: 12px !important;
}

.no-products p {
    color: #6b7280 !important;
    margin-bottom: 24px !important;
}
