
/* --- 1. SECTION & CONTAINER --- */
.chaaya-category-showcase {
    --ch-primary: #004e92; /* Blue for Chaaya */
    --ch-text: #1a1a1a;
    --ch-bg: #ffffff;
    --ch-border: #f0f0f0;
    
    padding: 50px 0;
    background: var(--ch-bg);
    width: 100%;
    display: block;
    border-bottom: 1px solid var(--ch-border);
    box-sizing: border-box;
}

/* Prachhaaya Theme Override */
.chaaya-category-showcase.theme-prachhaaya {
    --ch-primary: #2E7D32; /* Green */
}

.ch-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* --- 2. HEADER ROW (Split Layout) --- */
.ch-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Align bottom of text */
    width: 100%;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.ch-title-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ch-cat-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--ch-text);
    margin: 0;
    text-transform: uppercase;
    line-height: 1.1;
    letter-spacing: 0.5px;
}

.ch-cat-telugu {
    font-size: 20px;
    color: var(--ch-primary);
    font-weight: 500;
    line-height: 1;
}

.ch-view-all-btn {
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    background: #f5f5f5;
    padding: 10px 24px;
    border-radius: 50px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ch-view-all-btn:hover {
    background: var(--ch-primary);
    color: #fff;
}

/* --- 3. BOOK GRID (The Fix) --- */
.ch-cat-grid-wrapper {
    width: 100%;
    display: block;
    position: relative;
}

/* Force Grid Layout & Override Woo Floats */
.ch-cat-grid-wrapper ul.products {
    display: grid !important;
    /* minmax(0, 1fr) prevents collapse */
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Remove Pseudo Elements */
.ch-cat-grid-wrapper ul.products::before,
.ch-cat-grid-wrapper ul.products::after {
    display: none !important;
}

/* --- 4. PRODUCT CARD --- */
.ch-cat-grid-wrapper ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    float: none !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

/* Link Container (Fixes Image Width) */
.ch-cat-grid-wrapper ul.products li.product a.woocommerce-LoopProduct-link {
    display: block !important;
    width: 100% !important;
}

/* Image Styling */
.ch-cat-grid-wrapper ul.products li.product a img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3 !important; /* Perfect Book Ratio */
    object-fit: cover !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1) !important;
    margin: 0 0 15px 0 !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.ch-cat-grid-wrapper ul.products li.product:hover a img {
    transform: translateY(-8px) !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15) !important;
}

/* Title Styling */
.ch-cat-grid-wrapper ul.products li.product .woocommerce-loop-product__title {
    font-family: inherit !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--ch-text) !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
_    line-height: 1.4 !important;
    min-height: auto !important;
}

/* Price Styling */
.ch-cat-grid-wrapper ul.products li.product .price {
    font-size: 15px !important;
    color: var(--ch-primary) !important;
    font-weight: 700 !important;
    display: block !important;
    margin-bottom: 12px !important;
}

/* Add to Cart Button (Fixes "Thin Strip" Issue) */
.ch-cat-grid-wrapper ul.products li.product .button {
    display: block !important;
    width: 100% !important;
    padding: 12px 0 !important;
    border-radius: 6px !important;
    background-color: var(--ch-primary) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    text-align: center !important;
    margin-top: auto !important;
    border: none !important;
    box-sizing: border-box !important;
    line-height: 1.5 !important;
    white-space: nowrap !important; /* CRITICAL FIX */
}
.ch-cat-grid-wrapper ul.products li.product .button:hover {
    background-color: #333 !important;
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 900px) {
    .ch-cat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    /* 2-Column Grid Layout (Replaces Horizontal Scroll) */
    .ch-cat-grid-wrapper ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        overflow-x: visible !important;
        padding-bottom: 0 !important;
        margin-bottom: 20px !important;
    }
    
    .ch-cat-grid-wrapper ul.products li.product {
        flex: unset !important;
        width: auto !important;
        scroll-snap-align: none !important;
    }
    
    /* Ensure images fit nicely */
    .ch-cat-grid-wrapper ul.products li.product a img {
        margin-bottom: 10px !important;
    }
}
