/**
 * Shop and Category Page Layout
 * For product category and shop pages
 */

/* Page Layout for Category/Shop Pages */
body.tax-product_cat .page-layout,
body.post-type-archive-product .page-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(260px, 0.8fr);
    gap: 48px;
    align-items: flex-start;
    width: 100%;
}

body.tax-product_cat .page-main,
body.post-type-archive-product .page-main {
    width: auto;
    max-width: none;
    float: none;
}

body.tax-product_cat .page-sidebar,
body.post-type-archive-product .page-sidebar {
    width: auto;
    max-width: none;
    float: none;
}

/* Container Override */
body.tax-product_cat .container,
body.post-type-archive-product .container {
    max-width: 1240px;
    padding: 0px 40px;
}

/* Sidebar Cards */
.sidebar-widget {
    background: #fff;
    padding: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: none;
}

.sidebar-widget .widget-title {
    font-size: 18px;
    color: #1f2933;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #003366;
    font-weight: 600;
}

/* Search Widget */
.search-widget .search-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-widget .search-field {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.search-widget .search-field:focus {
    outline: none;
    border-color: #003366;
}

.search-widget .search-submit {
    width: 100%;
    height: 48px;
    background: #003366;
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.search-widget .search-submit:hover {
    background: #002244;
}

/* Product Categories */
.product-categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-categories-list li {
    padding: 10px 0;
    margin-bottom: 0;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
}

.product-categories-list li:last-child {
    border-bottom: none;
}

.product-categories-list li:hover {
    background: transparent;
    padding-left: 0;
}

.product-categories-list a {
    color: #4b5563;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.5;
}

.product-categories-list a:hover {
    color: #003366;
}

.product-categories-list .sub-menu {
    padding-left: 18px;
    margin-top: 8px;
}

.product-categories-list .sub-menu li {
    padding: 8px 0;
}

.category-count {
    background: #003366;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    body.tax-product_cat .container,
    body.post-type-archive-product .container {
        padding: 0 24px;
    }
    
    body.tax-product_cat .page-layout,
    body.post-type-archive-product .page-layout {
        gap: 32px;
        grid-template-columns: minmax(0, 2fr) minmax(240px, 0.7fr);
    }
}

@media (max-width: 768px) {
    body.tax-product_cat .container,
    body.post-type-archive-product .container {
        padding: 0 16px;
    }
    
    body.tax-product_cat .page-layout,
    body.post-type-archive-product .page-layout {
        display: flex;
        flex-direction: column;
        gap: 32px;
    }
    
    .sidebar-widget {
        padding: 20px;
    }
}

/* ============================================
   Product / Subcategory Grid - Fix thin cards
   Override WooCommerce columns-* widths that
   squeeze li.product-category inside grid cells
   ============================================ */
body.tax-product_cat .woocommerce ul.products,
body.post-type-archive-product .woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
}

body.tax-product_cat .woocommerce ul.products > li,
body.tax-product_cat .woocommerce ul.products > .product-category,
body.tax-product_cat .woocommerce ul.products > .product,
body.post-type-archive-product .woocommerce ul.products > li,
body.post-type-archive-product .woocommerce ul.products > .product-category,
body.post-type-archive-product .woocommerce ul.products > .product {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    float: none;
    clear: none;
    position: relative;
}

/* Subcategory Card */
body.tax-product_cat .woocommerce ul.products > .product-category,
body.post-type-archive-product .woocommerce ul.products > .product-category {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
    transition: box-shadow 0.2s ease;
}

body.tax-product_cat .woocommerce ul.products > .product-category:hover,
body.post-type-archive-product .woocommerce ul.products > .product-category:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.tax-product_cat .woocommerce ul.products > .product-category > a,
body.post-type-archive-product .woocommerce ul.products > .product-category > a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
}

/* Category image - fixed height area */
body.tax-product_cat .woocommerce ul.products > .product-category a img,
body.post-type-archive-product .woocommerce ul.products > .product-category a img {
    display: block;
    width: 100%;
    height: 180px;
    max-height: none;
    object-fit: contain;
    margin: 0;
    padding: 16px;
    box-sizing: border-box;
}

/* Category title row */
body.tax-product_cat .woocommerce ul.products > .product-category .woocommerce-loop-category__title,
body.post-type-archive-product .woocommerce ul.products > .product-category .woocommerce-loop-category__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: #1f2933;
    text-align: center;
    margin: 0;
    padding: 14px 14px 16px;
    border-top: 1px solid #e5e7eb;
}

/* Category count badge inside title */
body.tax-product_cat .woocommerce ul.products > .product-category .woocommerce-loop-category__title .count,
body.post-type-archive-product .woocommerce ul.products > .product-category .woocommerce-loop-category__title .count {
    background: #003366;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 10px;
    box-shadow: none;
}

@media (max-width: 600px) {
    body.tax-product_cat .woocommerce ul.products,
    body.post-type-archive-product .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}
