<?php
if (!defined('ABSPATH')) exit; // Exit if accessed directly

/**
 * WooCommerce Shop Functions
 *
 * @package pawfect
 */

// Shop sidebar is now registered in main functions.php

// Override WooCommerce sidebar
function pawfect_woocommerce_sidebar() {
    // Only run if WooCommerce functions exist
    if (function_exists('is_shop') && function_exists('is_product_category') && function_exists('is_product_tag')) {
        if (is_shop() || is_product_category() || is_product_tag()) {
            get_template_part('woocommerce/sidebar-shop');
        }
    }
}
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
add_action('woocommerce_sidebar', 'pawfect_woocommerce_sidebar', 10);

// Remove default WooCommerce wrappers
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

// Remove breadcrumbs (we use page header instead)
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);

// Add custom content wrappers
// NOTE: archive-product.php already outputs its own <main> wrapper,
// so we skip these wrappers on shop/product-taxonomy archives to avoid nesting <main> inside <main>.
function pawfect_woocommerce_output_content_wrapper() {
    if ( is_shop() || is_product_taxonomy() ) {
        return; // archive-product.php handles its own wrapper
    }
    echo '<main class="pawfect-main-content">';
}

function pawfect_woocommerce_output_content_wrapper_end() {
    if ( is_shop() || is_product_taxonomy() ) {
        return; // archive-product.php handles its own wrapper
    }
    echo '</main>';
}

add_action('woocommerce_before_main_content', 'pawfect_woocommerce_output_content_wrapper', 10);
add_action('woocommerce_after_main_content', 'pawfect_woocommerce_output_content_wrapper_end', 10);

// Customize product image size
function pawfect_woocommerce_product_image() {
    global $product;
    
    echo '<div class="pawfect-product-image-container">';
    echo '<img src="' . esc_url(wp_get_attachment_image_url($product->get_image_id(), 'full')) . '" alt="' . esc_attr($product->get_name()) . '" class="pawfect-w-full pawfect-h-64 pawfect-object-cover">';
    echo '</div>';
}

// Customize product title
function pawfect_woocommerce_product_title() {
    echo '<h3 class="pawfect-font-serif pawfect-text-xl"><a href="' . esc_url(get_permalink()) . '" class="hover:pawfect-text-accent">' . esc_html(get_the_title()) . '</a></h3>';
}

// Customize product price
function pawfect_woocommerce_product_price() {
    global $product;
    
    echo '<p class="pawfect-text-text-light pawfect-mt-1">';
    
    if ($product->is_on_sale()) {
        echo '<span class="pawfect-line-through pawfect-mr-2">' . wp_kses_post(wc_price($product->get_regular_price())) . '</span>';
        echo '<span class="pawfect-font-bold pawfect-text-accent">' . wp_kses_post(wc_price($product->get_sale_price())) . '</span>';
    } else {
        echo '<span class="pawfect-font-bold pawfect-text-accent">' . wp_kses_post(wc_price($product->get_price())) . '</span>';
    }
    
    echo '</p>';
}

// Replace default WooCommerce hooks with custom ones
remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10);
remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);

add_action('woocommerce_before_shop_loop_item_title', 'pawfect_woocommerce_product_image', 10);
add_action('woocommerce_shop_loop_item_title', 'pawfect_woocommerce_product_title', 10);
add_action('woocommerce_after_shop_loop_item_title', 'pawfect_woocommerce_product_price', 10);

// Customize sale flash
function pawfect_woocommerce_sale_flash() {
    global $product;
    
    if ($product->is_on_sale()) {
        echo '<div class="pawfect-absolute pawfect-top-3 pawfect-left-3 pawfect-bg-sale-bg pawfect-text-white pawfect-text-xs pawfect-uppercase pawfect-px-2 pawfect-py-1 pawfect-rounded-md pawfect-font-bold pawfect-z-10">' . esc_html__('Sale!', 'pawfect') . '</div>';
    }
}

remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
add_action('woocommerce_before_shop_loop_item_title', 'pawfect_woocommerce_sale_flash', 5);

// Set products per page
function pawfect_woocommerce_products_per_page() {
    return 9; // 3x3 grid
}
add_filter('loop_shop_per_page', 'pawfect_woocommerce_products_per_page', 20);

// Set product columns
function pawfect_woocommerce_loop_columns() {
    return 3;
}
add_filter('loop_shop_columns', 'pawfect_woocommerce_loop_columns');

// Override product loop start - Remove custom wrapper to let WooCommerce handle it
function pawfect_woocommerce_product_loop_start() {
    $shop_columns = get_theme_mod( 'pawfect_shop_columns', 3 );
    $classes = 'products pawfect-products-grid pawfect-grid pawfect-gap-8';
    
    switch ($shop_columns) {
        case 2: $classes .= ' pawfect-grid-cols-1 md:pawfect-grid-cols-2'; break;
        case 4: $classes .= ' pawfect-grid-cols-1 sm:pawfect-grid-cols-2 lg:pawfect-grid-cols-3 xl:pawfect-grid-cols-4'; break;
        case 5: $classes .= ' pawfect-grid-cols-1 sm:pawfect-grid-cols-2 lg:pawfect-grid-cols-3 xl:pawfect-grid-cols-5'; break;
        case 6: $classes .= ' pawfect-grid-cols-1 sm:pawfect-grid-cols-2 lg:pawfect-grid-cols-4 xl:pawfect-grid-cols-6'; break;
        default: $classes .= ' pawfect-grid-cols-1 md:pawfect-grid-cols-2 xl:pawfect-grid-cols-3';
    }
    
    return '<ul class="' . esc_attr($classes) . '" data-view="grid" data-columns="' . esc_attr($shop_columns) . '">';
}

// Override product loop end
function pawfect_woocommerce_product_loop_end() {
    return '</ul>';
}

// Remove the default WooCommerce loop wrappers and use our custom ones
remove_action('woocommerce_output_content_wrapper', 'woocommerce_output_content_wrapper', 10);
remove_action('woocommerce_output_content_wrapper_end', 'woocommerce_output_content_wrapper_end', 10);

// Ensure WooCommerce uses our loop structure
add_filter('woocommerce_product_loop_start', 'pawfect_woocommerce_product_loop_start');
add_filter('woocommerce_product_loop_end', 'pawfect_woocommerce_product_loop_end');

remove_action('woocommerce_output_content_wrapper', 'woocommerce_product_loop_start', 40);
remove_action('woocommerce_output_content_wrapper_end', 'woocommerce_product_loop_end', 40);

add_filter('woocommerce_product_loop_start', 'pawfect_woocommerce_product_loop_start');
add_filter('woocommerce_product_loop_end', 'pawfect_woocommerce_product_loop_end');

// Add theme color variables to WooCommerce
function pawfect_woocommerce_add_color_variables() {
    $color_css = ':root {
        --pawfect-background: #F5F0EB;
        --pawfect-accent: #D9A477;
        --pawfect-text-dark: #333333;
        --pawfect-text-light: #555555;
        --pawfect-footer-bg: #1E1E1E;
        --pawfect-border-color: #E0D8D1;
        --pawfect-sale-bg: #A3B18A;
    }';
    wp_add_inline_style('pawfect-style', $color_css);
}
add_action('wp_enqueue_scripts', 'pawfect_woocommerce_add_color_variables');

// Customize WooCommerce pagination to match blog pagination
function pawfect_woocommerce_pagination_args($args) {
    $args['prev_text'] = '←';
    $args['next_text'] = '→';
    $args['mid_size'] = 2;
    $args['end_size'] = 1;
    $args['type'] = 'plain';
    return $args;
}
add_filter('woocommerce_pagination_args', 'pawfect_woocommerce_pagination_args');

// Add custom wrapper for WooCommerce pagination to match blog style
function pawfect_woocommerce_pagination_wrapper_start() {
    echo '<div class="pawfect-pagination pawfect-mt-12 pawfect-text-center">';
}

function pawfect_woocommerce_pagination_wrapper_end() {
    echo '</div>';
}

// Hook the pagination wrappers
add_action('woocommerce_after_shop_loop', 'pawfect_woocommerce_pagination_wrapper_start', 9);
add_action('woocommerce_after_shop_loop', 'pawfect_woocommerce_pagination_wrapper_end', 11);

// Custom shop loop wrapper
function pawfect_woocommerce_before_shop_loop_wrapper() {
    echo '<div class="pawfect-flex pawfect-justify-between pawfect-items-center pawfect-mb-8">';
}

function pawfect_woocommerce_after_shop_loop_wrapper() {
    echo '</div>';
}

// Remove default WooCommerce result count and ordering from shop loop
remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);

// Remove default WooCommerce product loop content hooks to use our custom styling
remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10);
remove_action('woocommerce_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10);
remove_action('woocommerce_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5);

// Disable default WooCommerce wrapper for shop loop
remove_action('woocommerce_before_shop_loop', 'woocommerce_output_all_notices', 10);

add_action('woocommerce_before_shop_loop', 'pawfect_woocommerce_before_shop_loop_wrapper', 15);
add_action('woocommerce_before_shop_loop', 'pawfect_woocommerce_after_shop_loop_wrapper', 35);

// Add custom WooCommerce styles
function pawfect_woocommerce_custom_styles() {
    $wc_css = <<<PAWFECT_CSS
    /* WooCommerce Form Styling */
    .woocommerce .form-row input.input-text,
    .woocommerce .form-row textarea,
    .woocommerce .form-row select,
    .woocommerce-page .form-row input.input-text,
    .woocommerce-page .form-row textarea,
    .woocommerce-page .form-row select {
        width: 100%;
        padding: 12px;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
        font-size: 16px;
        background-color: #fff;
        transition: border-color 0.3s ease;
    }

    .woocommerce .form-row input.input-text:focus,
    .woocommerce .form-row textarea:focus,
    .woocommerce .form-row select:focus,
    .woocommerce-page .form-row input.input-text:focus,
    .woocommerce-page .form-row textarea:focus,
    .woocommerce-page .form-row select:focus {
        outline: none;
        border-color: var(--pawfect-primary, #D9A477);
        box-shadow: 0 0 0 2px rgba(217, 164, 119, 0.2);
    }

    .woocommerce .form-row label,
    .woocommerce-page .form-row label {
        display: block;
        margin-bottom: 8px;
        font-weight: bold;
        color: #333333;
    }

    /* Checkout form styling */
    .pawfect-input {
        width: 100%;
        padding: 12px;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
        font-size: 16px;
        background-color: #fff;
        transition: border-color 0.3s ease;
    }

    .pawfect-input:focus {
        outline: none;
        border-color: var(--pawfect-primary, #D9A477);
        box-shadow: 0 0 0 2px rgba(217, 164, 119, 0.2);
    }

    /* Button styling */
    .woocommerce .button,
    .woocommerce-page .button {
        background-color: var(--pawfect-primary, #D9A477);
        color: white;
        border: none;
        padding: 12px 24px;
        border-radius: 6px;
        font-weight: bold;
        text-transform: uppercase;
        cursor: pointer;
        transition: opacity 0.3s ease;
    }

    .woocommerce .button:hover,
    .woocommerce-page .button:hover {
        opacity: 0.9;
    }

    /* Proceed to checkout button */
    .woocommerce .wc-proceed-to-checkout .checkout-button {
        width: 100%;
        background-color: var(--pawfect-primary, #D9A477);
        color: white;
        padding: 16px;
        font-size: 18px;
        text-transform: uppercase;
        font-weight: bold;
        border-radius: 6px;
        border: none;
        cursor: pointer;
        transition: opacity 0.3s ease;
    }

    .woocommerce .wc-proceed-to-checkout .checkout-button:hover {
        opacity: 0.9;
    }

    /* Rating stars */
    .woocommerce .star-rating {
        color: #fbbf24;
    }

    /* Product meta styling */
    .woocommerce div.product .product_meta {
        border-top: 1px solid #E0D8D1;
        padding-top: 24px;
        margin-top: 24px;
    }

    .woocommerce div.product .product_meta > span {
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        color: #555555;
    }

    .woocommerce div.product .product_meta a {
        color: var(--pawfect-primary, #D9A477);
        text-decoration: none;
        transition: color 0.3s ease;
    }

    .woocommerce div.product .product_meta a:hover {
        color: #333333;
    }

    /* Breadcrumb styling */
    .woocommerce .woocommerce-breadcrumb {
        font-size: 14px;
        color: #555555;
    }

    .woocommerce .woocommerce-breadcrumb a {
        color: #555555;
        text-decoration: none;
        transition: color 0.3s ease;
    }

    .woocommerce .woocommerce-breadcrumb a:hover {
        color: var(--pawfect-primary, #D9A477);
    }

    /* Price styling */
    .woocommerce .price {
        color: var(--pawfect-primary, #D9A477);
        font-weight: bold;
    }

    .woocommerce .price del {
        color: #555555;
        opacity: 0.7;
    }

    /* Sale flash */
    .woocommerce span.onsale {
        background-color: #A3B18A;
        color: white;
        font-size: 12px;
        text-transform: uppercase;
        padding: 4px 8px;
        border-radius: 4px;
        font-weight: bold;
    }

    /* Cart table styling */
    .woocommerce table.shop_table {
        border: none;
        border-collapse: separate;
        border-spacing: 0;
    }

    .woocommerce table.shop_table th,
    .woocommerce table.shop_table td {
        border: none;
        border-bottom: 1px solid #E0D8D1;
        padding: 16px;
        vertical-align: middle;
    }

    .woocommerce table.shop_table th {
        background-color: #f9fafb;
        font-weight: bold;
        color: #333333;
    }

    .woocommerce table.shop_table .product-thumbnail img {
        width: 64px;
        height: 64px;
        object-fit: cover;
        border-radius: 6px;
    }

    .woocommerce table.shop_table .product-name a {
        font-weight: bold;
        color: #333333;
        text-decoration: none;
        transition: color 0.3s ease;
    }

    .woocommerce table.shop_table .product-name a:hover {
        color: var(--pawfect-primary, #D9A477);
    }

    .woocommerce table.shop_table .product-remove a {
        color: #ef4444;
        font-size: 18px;
        text-decoration: none;
        transition: color 0.3s ease;
    }

    .woocommerce table.shop_table .product-remove a:hover {
        color: #dc2626;
    }

    /* Quantity input in cart */
    .woocommerce .quantity input.qty {
        width: 80px;
        padding: 8px;
        text-align: center;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
    }

    /* Checkout styling */
    .woocommerce .checkout .col2-set {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    @media (max-width: 1024px) {
        .woocommerce .checkout .col2-set {
            grid-template-columns: 1fr;
        }
    }

    .woocommerce .checkout h3 {
        font-family: 'Playfair Display', serif;
        font-size: 24px;
        margin-bottom: 24px;
        color: #333333;
    }

    /* Order review table */
    .woocommerce-checkout-review-order-table th,
    .woocommerce-checkout-review-order-table td {
        padding: 16px 0;
        border-bottom: 1px solid #E0D8D1;
    }

    .woocommerce-checkout-review-order-table .product-name {
        font-weight: bold;
    }

    .woocommerce-checkout-review-order-table .product-total {
        text-align: right;
        font-weight: bold;
        color: var(--pawfect-primary, #D9A477);
    }

    /* Payment methods */
    .woocommerce .payment_methods {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .woocommerce .payment_methods li {
        margin-bottom: 16px;
        padding: 16px;
        background-color: white;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
    }

    .woocommerce .payment_methods li label {
        font-weight: bold;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .woocommerce .payment_methods li input[type="radio"] {
        margin-right: 12px;
    }

    /* Place order button */
    .woocommerce #place_order {
        width: 100%;
        background-color: var(--pawfect-primary, #D9A477);
        color: white;
        padding: 16px;
        font-size: 18px;
        text-transform: uppercase;
        font-weight: bold;
        border-radius: 6px;
        border: none;
        cursor: pointer;
        transition: opacity 0.3s ease;
        margin-top: 24px;
    }

    .woocommerce #place_order:hover {
        opacity: 0.9;
    }

    /* Notices */
    .woocommerce .woocommerce-message,
    .woocommerce .woocommerce-info,
    .woocommerce .woocommerce-error {
        padding: 16px;
        margin-bottom: 24px;
        border-radius: 6px;
        border-left: 4px solid;
    }

    .woocommerce .woocommerce-message {
        background-color: #f0fdf4;
        border-left-color: #22c55e;
        color: #166534;
    }

    .woocommerce .woocommerce-info {
        background-color: #eff6ff;
        border-left-color: #3b82f6;
        color: #1e40af;
    }

    .woocommerce .woocommerce-error {
        background-color: #fef2f2;
        border-left-color: #ef4444;
        color: #dc2626;
    }

    /* Shop page specific styling */
    .woocommerce .woocommerce-result-count {
        color: #555555;
        font-size: 14px;
        margin-bottom: 16px;
    }

    .woocommerce .woocommerce-ordering select {
        padding: 8px 12px;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
        background-color: white;
        color: #333333;
        font-size: 14px;
    }

    /* Product loop add to cart buttons */
    .woocommerce ul.products li.product .button {
        background-color: var(--pawfect-primary, #D9A477);
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: bold;
        text-transform: uppercase;
        cursor: pointer;
        transition: opacity 0.3s ease;
        text-decoration: none;
        display: inline-block;
    }

    .woocommerce ul.products li.product .button:hover {
        opacity: 0.9;
        color: white;
    }

    /* Price filter widget styling */
    .pawfect-price-filter .price_slider_wrapper {
        margin-bottom: 16px;
    }

    .pawfect-price-filter .price_slider {
        background-color: #E0D8D1;
        height: 4px;
        border-radius: 2px;
        margin-bottom: 16px;
    }

    .pawfect-price-filter .ui-slider-handle {
        background-color: var(--pawfect-primary, #D9A477);
        border: none;
        border-radius: 50%;
        width: 16px;
        height: 16px;
        cursor: pointer;
    }

    .pawfect-price-filter .price_slider_amount {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .pawfect-price-filter .price_slider_amount input {
        padding: 8px;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
        width: 80px;
        text-align: center;
        font-size: 14px;
    }

    .pawfect-price-filter .price_slider_amount .button {
        background-color: var(--pawfect-primary, #D9A477);
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 6px;
        font-size: 14px;
        cursor: pointer;
        transition: opacity 0.3s ease;
    }

    .pawfect-price-filter .price_slider_amount .button:hover {
        opacity: 0.9;
    }

    /* Product rating stars */
    .woocommerce .star-rating {
        font-size: 14px;
        color: #fbbf24;
    }

    .woocommerce .star-rating::before {
        color: #e5e7eb;
    }

    /* Pagination styling */
    .woocommerce nav.woocommerce-pagination {
        margin-top: 32px;
        text-align: center;
    }

    .woocommerce nav.woocommerce-pagination ul {
        display: inline-flex;
        gap: 8px;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .woocommerce nav.woocommerce-pagination ul li {
        margin: 0;
    }

    .woocommerce nav.woocommerce-pagination ul li a,
    .woocommerce nav.woocommerce-pagination ul li span {
        display: inline-block;
        padding: 8px 12px;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
        color: #333333;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .woocommerce nav.woocommerce-pagination ul li a:hover,
    .woocommerce nav.woocommerce-pagination ul li span.current {
        background-color: var(--pawfect-primary, #D9A477);
        color: white;
        border-color: var(--pawfect-primary, #D9A477);
    }

    /* Checkout and Cart page specific styling */
    .pawfect-checkout-page .woocommerce-checkout,
    .pawfect-cart-page .woocommerce {
        font-family: 'Lato', sans-serif;
    }

    .pawfect-checkout-page h2,
    .pawfect-checkout-page h3,
    .pawfect-cart-page h2,
    .pawfect-cart-page h3 {
        font-family: 'Playfair Display', serif;
        font-size: 24px;
        margin-bottom: 24px;
        color: #333333;
    }

    /* Form inputs styling to match HTML design */
    .woocommerce .form-row input.input-text,
    .woocommerce .form-row select,
    .woocommerce .form-row textarea {
        width: 100%;
        padding: 12px;
        border: 1px solid #E0D8D1;
        border-radius: 6px;
        background-color: #FFFFFF;
        color: #333333;
        font-size: 14px;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    .woocommerce .form-row input.input-text:focus,
    .woocommerce .form-row select:focus,
    .woocommerce .form-row textarea:focus {
        outline: none;
        border-color: var(--pawfect-primary, #D9A477);
        box-shadow: 0 0 0 2px rgba(217, 164, 119, 0.2);
    }

    .woocommerce .form-row label {
        display: block;
        margin-bottom: 8px;
        font-weight: bold;
        color: #333333;
    }

    /* Cart table improvements */
    .pawfect-cart-page .woocommerce table.shop_table {
        background-color: white;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: none;
        margin: 0;
    }

    .pawfect-cart-page .woocommerce table.shop_table th {
        background-color: #f9fafb;
        padding: 20px;
        font-weight: bold;
        color: #333333;
        border-bottom: 1px solid #E0D8D1;
    }

    .pawfect-cart-page .woocommerce table.shop_table td {
        padding: 20px;
        border-bottom: 1px solid #E0D8D1;
        vertical-align: middle;
    }

    /* Order summary styling */
    .pawfect-order-summary h2,
    .woocommerce-checkout-review-order h3 {
        font-family: 'Playfair Display', serif;
        font-size: 24px;
        border-bottom: 1px solid #E0D8D1;
        padding-bottom: 16px;
        margin-bottom: 24px;
        color: #333333;
    }

  
   

    /* Ensure proper grid layout for checkout */
    .pawfect-checkout-page .pawfect-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    @media (min-width: 1024px) {
        .pawfect-checkout-page .pawfect-grid {
            grid-template-columns: 1fr 1fr;
            gap: 4rem;
        }
    }

    /* Fix sidebar spacing in shop page */
    .pawfect-sticky.pawfect-top-8.pawfect-space-y-8 > * + * {
        margin-top: 2rem;
    }

    /* Ensure product cards maintain aspect ratio and proper layout */
    .pawfect-products-grid .pawfect-group .pawfect-h-64 {
        height: 16rem;
        min-height: 16rem;
    }

    .pawfect-products-grid .pawfect-group {
        display: flex;
        flex-direction: column;
        height: 100%;
    }



 
    /* Fix modern card button container */
    .pawfect-products-grid .pawfect-shop-card-modern .pawfect-category-card {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .pawfect-products-grid .pawfect-shop-card-modern .pawfect-category-card > a {
        display: flex;
        flex-direction: column;
        flex: 1;
    }

 

    /* Hover effect for rounded backgrounds */
    .pawfect-products-grid .pawfect-group:hover .pawfect-bg-white,
    .pawfect-shop-card:hover .pawfect-bg-white,
    .pawfect-category-card:hover {
        background-position: 0% 100% !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
    }

    /* Ensure text remains readable on gradient background */
    .pawfect-products-grid .pawfect-group:hover .pawfect-text-gray-900,
    .pawfect-products-grid .pawfect-group:hover .pawfect-text-gray-800,
    .pawfect-shop-card:hover .pawfect-text-gray-900,
    .pawfect-shop-card:hover .pawfect-text-gray-800 {
        color: #ffffff !important;
        transition: color 0.3s ease !important;
    }

    /* Product image container rounded corners */
    .pawfect-products-grid .pawfect-group .pawfect-h-64,
    .pawfect-shop-card .pawfect-h-64 {
        border-radius: 1rem 1rem 0 0 !important;
        overflow: hidden !important;
    }

    /* Shop sidebar and filter elements with rounded backgrounds */
    .pawfect-shop-sidebar .pawfect-bg-white,
    .woocommerce-widget-layered-nav,
    .widget_product_categories,
    .widget_price_filter {
        border-radius: 1rem !important;
        padding: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        transition: all 0.3s ease !important;
    }

    

    /* Product pagination with rounded style */
    /*.woocommerce-pagination .page-numbers {
        border-radius: 0.5rem !important;
        background: linear-gradient(135deg, #ffffff 0%, var(--pawfect-secondary, #313134) 100%) !important;
        background-size: 200% 200% !important;
        background-position: 100% 0% !important;
        transition: all 0.3s ease !important;
        border: 1px solid rgba(var(--pawfect-secondary-rgb, 49, 49, 52), 0.2) !important;
    }

    .woocommerce-pagination .page-numbers:hover,
    .woocommerce-pagination .page-numbers.current {
        background-position: 0% 100% !important;
        color: #ffffff !important;
        transform: translateY(-1px) !important;
    }*/

    .pawfect-products-grid .pawfect-shop-card-modern .pawfect-p-6 {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .pawfect-products-grid .pawfect-group .pawfect-p-6 {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Fix checkout form column classes */
    .woocommerce-checkout .col-1,
    .woocommerce-checkout .col-2 {
        width: 100%;
    }

    /* Responsive adjustments */
    @media (max-width: 1023px) {
        .pawfect-checkout-page .pawfect-sticky {
            position: static !important;
        }

        .pawfect-checkout-page .pawfect-grid {
            grid-template-columns: 1fr !important;
            gap: 2rem !important;
        }
    }
PAWFECT_CSS;
    wp_add_inline_style('pawfect-style', $wc_css);
}
add_action('wp_enqueue_scripts', 'pawfect_woocommerce_custom_styles');
