/* ==========================================================================
   1. Root & Variables
   ========================================================================== */
:root {
    --bs-primary: #2b59a2;
    --bs-primary-rgb: 43, 89, 162;
    --bs-success: #198754;
    --bs-danger: #d9251d;
    --bs-dark: #422828;
    --bs-dark-subtil: #686464;
    --bs-light: #5f3131;

    --red-trans: rgba(217, 38, 29, 0.57);
    /* #d9261d91 */
    --dark-trans: rgba(29, 28, 20, 0.71);
    /* #1d1c14b6 */
    --bs-link-color: #1d1c14;
    --bs-link-hover-color: #d9251d;

    --addtocart-btn-bg: rgba(39, 9, 9, 0.71);
    --addtocart-btn-bg-hover: rgba(143, 24, 24, 0.71);
    --price-color: #52110d;
}



/* ===== 1. CORE CONTAINER & SHARED STYLES ===== */
.fancy-shop-container {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 30px 0 !important;
    width: 100% !important;
}

.fancy-shop-container li.fancy-product-item {
    width: 100% !important;
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
    display: block !important;
}

.product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    transition: all 0.3s ease-in-out;
}

.product-card:hover {
    /* box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1); */
    transform: translateY(-5px);
    /* Lifts the card slightly */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--bs-link-color);
}

.product-image-col img {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain;
}

.fancy-shop-container .product-meta {
    color: var(--bs-danger) !important;
    margin-bottom: .6rem !important;
}

/* ===== 2. DESKTOP STYLES (769px and up) ===== */
@media (min-width: 992px) {

    /* --- LIST VIEW --- */
    .fancy-shop-container[data-layout="list"] .product-card {
        flex-direction: row !important;
        align-items: stretch !important;
        min-height: 180px;
    }

    .fancy-shop-container[data-layout="list"] .product-card:hover {
        border: 1px solid var(--bs-dark);
    }

    .fancy-shop-container[data-layout="list"] .product-image-col {
        flex: 0 0 200px !important;
        /* Fixed width for desktop list image */
        padding: 15px;
        background: #fff;
        border-right: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .fancy-shop-container[data-layout="list"] .product-details-col {
        flex: 1 !important;
        /* Middle section stretches */
        padding: 20px !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
    }

    .fancy-shop-container[data-layout="list"] .woocommerce-loop-product__title {
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }

    .fancy-shop-container[data-layout="list"] .woocommerce-loop-product__title a {
        font-size: 1rem !important;
        margin-bottom: 8px !important;
        color: var(--bs-dark) !important;
    }

    .fancy-shop-container[data-layout="list"] .woocommerce-loop-product__title a:hover {
        color: var(--bs-primary) !important;
    }

    .fancy-shop-container[data-layout="list"] .product-actions-col {
        flex: 0 0 220px !important;
        /* Fixed width for right-side price box */
        background: #fbfbfb;
        border-left: 1px solid #f0f0f0;
        padding: 20px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .fancy-shop-container[data-layout="list"] .product-actions-col .product-price {
        color: var(--price-color) !important;
        font-size: 1rem !important;
        font-weight: 800;
    }


    /* --- GRID VIEW --- */
    .fancy-shop-container[data-layout="grid"] {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }

    .fancy-shop-container[data-layout="grid"] .product-card {
        flex-direction: column !important;
        height: 100%;

    }

    .fancy-shop-container[data-layout="grid"] .product-card .product-details-col {
        padding: 0px 10px 0px 10px !important;
    }

    .fancy-shop-container[data-layout="grid"] .product-card .product-details-col h2 {
        font-size: 1rem !important;
        font-weight: 400 !important;
    }

    .fancy-shop-container[data-layout="grid"] .product-card .product-details-col h2 a {
        font-size: 1rem !important;
        color: var(--bs-dark);
        font-weight: 400 !important;
    }

    .fancy-shop-container[data-layout="grid"] .product-card .product-details-col h2 a:hover {
        color: var(--bs-primary);
    }

    .fancy-shop-container[data-layout="grid"] .product-image-col {
        width: 100% !important;
        height: 200px !important;
        border-bottom: 1px solid #c7c7c7 !important;
        margin-bottom: 10px;
        overflow-y: hidden !important;
    }

    .fancy-shop-container[data-layout="grid"] .product-image-col img {
        width: 100% !important;
        max-height: 200px;
        overflow-y: hidden;
    }


    .fancy-shop-container[data-layout="grid"] .product-actions-col {
        padding: 0px 10px 0px 10px !important;
        margin-bottom: 10px !important;
    }

    .fancy-shop-container[data-layout="grid"] .product-actions-col .product-price {
        display: block;
        margin: 10px 0px 10px 0px;
        font-weight: 700;
        font-size: 1.1rem !important;
        color: var(--price-color) !important;
    }

}




/* ===== 3. MOBILE STYLES (Small Screen Fix) ===== */
@media (max-width: 992px) {

    /* 1. Ensure the grid container doesn't squish */
    .fancy-shop-container[data-layout] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 items per row */
        gap: 10px !important;
        padding: 10px !important;
        width: 100% !important;
    }

    /* 2. Fix the card container */
    .product-card {
        display: flex !important;
        flex-direction: column !important;
        /* Stack image -> details -> actions */
        height: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        /* Crucial: allows content to shrink */
        overflow: hidden;
    }

    /* 3. Image Section */
    .product-image-col {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        flex: none !important;
        /* Stop it from growing/shrinking weirdly */
    }

    /* 4. Details Section (The area that was squeezing) */
    .product-details-col {
        padding: 8px !important;
        flex: 1 0 auto !important;
        /* Grow to fill space */
        width: 100% !important;
        min-width: 0 !important;
        /* Prevents text from forcing width */
        display: block !important;
        /* Change from flex to block for standard text flow */
    }

    /* 5. Fix the Vertical Text Issue */
    .woocommerce-loop-product__title {
        display: block !important;
        width: 100% !important;
        white-space: normal !important;
        /* Allows text to wrap to next line */
        word-wrap: break-word !important;
        font-size: 0.85rem !important;
        margin-bottom: 5px !important;
    }


    .product-details-col .woocommerce-loop-product__title a {
        color: var(--bs-dark) !important;
    }

    /* 6. Meta info (Brands, Sides, etc.) */
    .product-meta,
    .product-meta div {
        font-size: 11px !important;
        line-height: 1.2 !important;
        white-space: normal !important;
    }

    /* 7. Actions Section (Price & Button) */
    .product-actions-col {
        width: 100% !important;
        padding: 8px !important;
        flex: none !important;
        background: #fff !important;
        border: none !important;
        /* Remove desktop left borders */
        margin-top: auto !important;
        /* Push to bottom of card */
    }


    .product-actions-col .price {
        margin-bottom: 20px;
        color: #52110d;
        font-weight: 600;
    }



    .button.view-product-button {
        width: 100% !important;
        padding: 8px 4px !important;
        font-size: 11px !important;
        display: block !important;
        text-align: center;
    }
}