/**
 * JDS Shop / Store Page Styles
 *
 * Branded WooCommerce shop layout with hero, category tabs,
 * and styled product cards matching JDS green design system.
 *
 * @package JDS_Kadence_Child
 */

/* ──────────────────────────────────────
   CSS Variables (inherits from :root in functions.php)
   ────────────────────────────────────── */
.woocommerce-shop,
.post-type-archive-product,
.tax-product_cat {
    --shop-green:       #16a34a;
    --shop-green-hover: #15803d;
    --shop-green-light: #f0fdf4;
    --shop-green-50:    #f0fdf4;
    --shop-green-100:   #dcfce7;
    --shop-green-600:   #16a34a;
    --shop-green-700:   #15803d;
    --shop-green-800:   #166534;
    --shop-gray-50:     #f9fafb;
    --shop-gray-100:    #f3f4f6;
    --shop-gray-200:    #e5e7eb;
    --shop-gray-300:    #d1d5db;
    --shop-gray-400:    #9ca3af;
    --shop-gray-500:    #6b7280;
    --shop-gray-600:    #4b5563;
    --shop-gray-700:    #374151;
    --shop-gray-800:    #1f2937;
    --shop-gray-900:    #111827;
    --shop-radius:      12px;
    --shop-radius-sm:   8px;
    --shop-shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shop-shadow-md:   0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shop-shadow-lg:   0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}


/* ──────────────────────────────────────
   0. Page-Level Overrides
   ────────────────────────────────────── */

/* Remove Kadence boxed content padding on shop */
.woocommerce-shop .content-container.site-container,
.tax-product_cat .content-container.site-container {
    max-width: 100% !important;
    padding: 0 !important;
}

.woocommerce-shop .content-wrap,
.tax-product_cat .content-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* Kill Kadence hero on shop */
.woocommerce-shop .entry-hero,
.woocommerce-shop .product-hero-section,
.tax-product_cat .entry-hero,
.tax-product_cat .product-hero-section {
    display: none !important;
}

/* Remove Kadence archive title */
.woocommerce-shop .woocommerce-products-header,
.tax-product_cat .woocommerce-products-header {
    display: none !important;
}


/* ──────────────────────────────────────
   1. Shop Hero Section
   ────────────────────────────────────── */
.jds-shop-hero {
    background: linear-gradient(135deg, var(--shop-green-50) 0%, #ffffff 50%, var(--shop-green-50) 100%);
    border-bottom: 1px solid var(--shop-gray-200);
    padding: 3rem 1.5rem 2.5rem;
    text-align: center;
}

.jds-shop-hero__inner {
    max-width: 720px;
    margin: 0 auto;
}

.jds-shop-hero__title {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--shop-gray-900);
    margin: 0 0 0.75rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.jds-shop-hero__desc {
    font-size: 1.125rem;
    color: var(--shop-gray-500);
    margin: 0 0 1.5rem;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Trust badges */
.jds-shop-hero__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.jds-shop-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--shop-green-700);
    background: var(--shop-green-100);
    border: 1px solid rgba(22, 163, 74, 0.15);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
}

.jds-shop-badge svg {
    flex-shrink: 0;
    color: var(--shop-green-600);
}


/* ──────────────────────────────────────
   2. Category Filter Tabs
   ────────────────────────────────────── */
.jds-shop-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 0 0.5rem;
    margin-bottom: 0.5rem;
}

.jds-shop-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none !important;
    color: var(--shop-gray-600);
    background: var(--shop-gray-100);
    border: 1px solid var(--shop-gray-200);
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.jds-shop-tab:hover {
    color: var(--shop-green-700);
    background: var(--shop-green-50);
    border-color: var(--shop-green-600);
}

.jds-shop-tab--active {
    color: #fff !important;
    background: var(--shop-green-600) !important;
    border-color: var(--shop-green-600) !important;
}

.jds-shop-tab--active:hover {
    background: var(--shop-green-700) !important;
    border-color: var(--shop-green-700) !important;
}

.jds-shop-tab__count {
    font-size: 0.75rem;
    opacity: 0.7;
}


/* ──────────────────────────────────────
   3. Product Grid
   ────────────────────────────────────── */

/* Force 3 columns */
.woocommerce-shop ul.products,
.tax-product_cat ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem !important;
    padding: 1rem 0 !important;
    list-style: none !important;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .woocommerce-shop ul.products,
    .tax-product_cat ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .woocommerce-shop ul.products,
    .tax-product_cat ul.products {
        grid-template-columns: 1fr;
    }
}


/* ──────────────────────────────────────
   4. Product Cards
   ────────────────────────────────────── */
.woocommerce-shop ul.products li.product,
.tax-product_cat ul.products li.product {
    background: #fff;
    border: 1px solid var(--shop-gray-200);
    border-radius: var(--shop-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
}

.woocommerce-shop ul.products li.product:hover,
.tax-product_cat ul.products li.product:hover {
    border-color: var(--shop-green-600);
    box-shadow: var(--shop-shadow-lg);
    transform: translateY(-2px);
}

/* Hide placeholder product images on cards */
.woocommerce-shop ul.products li.product .woocommerce-loop-image-link,
.tax-product_cat ul.products li.product .woocommerce-loop-image-link,
.woocommerce-shop ul.products li.product img.wp-post-image,
.tax-product_cat ul.products li.product img.wp-post-image,
.woocommerce-shop ul.products li.product .woocommerce-placeholder,
.tax-product_cat ul.products li.product .woocommerce-placeholder {
    display: none !important;
}

/* Kadence wraps content in product-details — make it fill */
.woocommerce-shop ul.products li.product .product-details,
.tax-product_cat ul.products li.product .product-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Category badge */
.jds-product-cat-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--shop-green-700);
    background: var(--shop-green-50);
    border: 1px solid rgba(22, 163, 74, 0.12);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    width: fit-content;
}

/* Product title */
.woocommerce-shop ul.products li.product .woocommerce-loop-product__title,
.tax-product_cat ul.products li.product .woocommerce-loop-product__title,
.woocommerce-shop ul.products li.product .woocommerce-loop-product__title a,
.tax-product_cat ul.products li.product .woocommerce-loop-product__title a {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 1.0625rem !important;
    font-weight: 700 !important;
    color: var(--shop-gray-900) !important;
    text-decoration: none !important;
    line-height: 1.35;
    margin: 0 0 0.5rem !important;
    padding: 0 !important;
}

/* Price */
.woocommerce-shop ul.products li.product .price,
.tax-product_cat ul.products li.product .price {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: var(--shop-green-600) !important;
    margin: 0 0 0.5rem !important;
    line-height: 1.2;
}

.woocommerce-shop ul.products li.product .price .woocommerce-Price-currencySymbol,
.tax-product_cat ul.products li.product .price .woocommerce-Price-currencySymbol {
    font-size: 1rem;
    vertical-align: super;
    margin-right: 1px;
}

/* Short description excerpt */
.jds-product-excerpt {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--shop-gray-500);
    margin: 0 0 1rem !important;
    flex: 1;
}

/* ──────────────────────────────────────
   5. Add to Cart Button
   ────────────────────────────────────── */
.woocommerce-shop ul.products li.product .button,
.tax-product_cat ul.products li.product .button,
.woocommerce-shop ul.products li.product a.add_to_cart_button,
.tax-product_cat ul.products li.product a.add_to_cart_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    padding: 0.65rem 1rem !important;
    border-radius: var(--shop-radius-sm) !important;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    text-align: center;
    white-space: nowrap;
    margin-top: auto !important;
    line-height: 1.4 !important;
}

/* Formation Services → solid green button */
.woocommerce-shop ul.products li.product.product_cat-formation-services .button,
.woocommerce-shop ul.products li.product.product_cat-formation-services a.add_to_cart_button,
.tax-product_cat ul.products li.product.product_cat-formation-services .button,
.tax-product_cat ul.products li.product.product_cat-formation-services a.add_to_cart_button {
    background: var(--shop-green-600) !important;
    color: #fff !important;
    border: 2px solid var(--shop-green-600) !important;
}

.woocommerce-shop ul.products li.product.product_cat-formation-services .button:hover,
.woocommerce-shop ul.products li.product.product_cat-formation-services a.add_to_cart_button:hover,
.tax-product_cat ul.products li.product.product_cat-formation-services .button:hover,
.tax-product_cat ul.products li.product.product_cat-formation-services a.add_to_cart_button:hover {
    background: var(--shop-green-700) !important;
    border-color: var(--shop-green-700) !important;
}

/* Add-on Services → outline green button */
.woocommerce-shop ul.products li.product.product_cat-formation-addons .button,
.woocommerce-shop ul.products li.product.product_cat-formation-addons a.add_to_cart_button,
.tax-product_cat ul.products li.product.product_cat-formation-addons .button,
.tax-product_cat ul.products li.product.product_cat-formation-addons a.add_to_cart_button {
    background: transparent !important;
    color: var(--shop-green-600) !important;
    border: 2px solid var(--shop-green-600) !important;
}

.woocommerce-shop ul.products li.product.product_cat-formation-addons .button:hover,
.woocommerce-shop ul.products li.product.product_cat-formation-addons a.add_to_cart_button:hover,
.tax-product_cat ul.products li.product.product_cat-formation-addons .button:hover,
.tax-product_cat ul.products li.product.product_cat-formation-addons a.add_to_cart_button:hover {
    background: var(--shop-green-600) !important;
    color: #fff !important;
}

/* Default fallback button style (no category match) */
.woocommerce-shop ul.products li.product .button,
.tax-product_cat ul.products li.product .button {
    background: var(--shop-green-600) !important;
    color: #fff !important;
    border: 2px solid var(--shop-green-600) !important;
}

.woocommerce-shop ul.products li.product .button:hover,
.tax-product_cat ul.products li.product .button:hover {
    background: var(--shop-green-700) !important;
    border-color: var(--shop-green-700) !important;
    color: #fff !important;
}

/* "View cart" link after adding */
.woocommerce-shop ul.products li.product .added_to_cart,
.tax-product_cat ul.products li.product .added_to_cart {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--shop-green-600);
    text-decoration: none;
    margin-top: 0.5rem;
    font-weight: 500;
}

.woocommerce-shop ul.products li.product .added_to_cart:hover,
.tax-product_cat ul.products li.product .added_to_cart:hover {
    color: var(--shop-green-700);
    text-decoration: underline;
}

/* Loading spinner on AJAX add-to-cart */
.woocommerce-shop ul.products li.product .button.loading::after,
.tax-product_cat ul.products li.product .button.loading::after {
    border-color: rgba(255,255,255,0.3) !important;
    border-top-color: #fff !important;
}


/* ──────────────────────────────────────
   6. Kadence Overrides for Shop
   ────────────────────────────────────── */

/* Remove Kadence product action wrap backgrounds */
.woocommerce-shop ul.products li.product .product-action-wrap,
.tax-product_cat ul.products li.product .product-action-wrap {
    background: none !important;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0 !important;
}

/* Remove Kadence hover overlay effects */
.woocommerce-shop ul.products li.product .product-action-wrap::before,
.tax-product_cat ul.products li.product .product-action-wrap::before {
    display: none !important;
}

/* Kadence content wrap */
.woocommerce-shop ul.products li.product .content-bg .product-details .woocommerce-loop-product__link,
.tax-product_cat ul.products li.product .content-bg .product-details .woocommerce-loop-product__link {
    text-decoration: none !important;
}

/* Remove Kadence's result count + ordering bar (we use tabs instead) */
.woocommerce-shop .kadence-shop-top-row,
.tax-product_cat .kadence-shop-top-row {
    display: none !important;
}

/* Remove Kadence archive loop top wrapper if empty */
.woocommerce-shop .woo-results-count-left,
.tax-product_cat .woo-results-count-left {
    display: none !important;
}


/* ──────────────────────────────────────
   7. Cart / Checkout Button Styles integration
   ────────────────────────────────────── */
.woocommerce-shop .woocommerce-message,
.tax-product_cat .woocommerce-message {
    border-top-color: var(--shop-green-600);
    background: var(--shop-green-50);
}

.woocommerce-shop .woocommerce-message .button,
.tax-product_cat .woocommerce-message .button {
    background: var(--shop-green-600) !important;
    color: #fff !important;
    border-radius: var(--shop-radius-sm) !important;
    font-weight: 600 !important;
}


/* ──────────────────────────────────────
   8. Star Rating (if ever enabled)
   ────────────────────────────────────── */
.woocommerce-shop ul.products li.product .star-rating span::before,
.tax-product_cat ul.products li.product .star-rating span::before {
    color: #f59e0b;
}


/* ──────────────────────────────────────
   9. Responsive Fine-Tuning
   ────────────────────────────────────── */
@media (max-width: 768px) {
    .jds-shop-hero {
        padding: 2rem 1rem 1.75rem;
    }

    .jds-shop-hero__title {
        font-size: 1.75rem;
    }

    .jds-shop-hero__desc {
        font-size: 1rem;
    }

    .jds-shop-hero__badges {
        gap: 0.5rem;
    }

    .jds-shop-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    .jds-shop-tabs {
        gap: 0.375rem;
        padding: 1rem 0 0.25rem;
    }

    .jds-shop-tab {
        padding: 0.4rem 0.9rem;
        font-size: 0.8125rem;
    }

    .woocommerce-shop ul.products li.product,
    .tax-product_cat ul.products li.product {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .jds-shop-hero__title {
        font-size: 1.5rem;
    }

    .jds-shop-hero__badges {
        flex-direction: column;
        align-items: center;
    }

    .jds-shop-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .jds-shop-tab {
        justify-content: center;
    }
}


/* ──────────────────────────────────────
   10. WooCommerce Notices on Shop
   ────────────────────────────────────── */
.woocommerce-shop .woocommerce-notices-wrapper,
.tax-product_cat .woocommerce-notices-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Notice styling */
.woocommerce-shop .woocommerce-info,
.woocommerce-shop .woocommerce-message,
.tax-product_cat .woocommerce-info,
.tax-product_cat .woocommerce-message {
    border-radius: var(--shop-radius-sm);
    font-family: 'Inter', -apple-system, sans-serif;
}


/* ──────────────────────────────────────
   11. Pagination (if > 24 products)
   ────────────────────────────────────── */
.woocommerce-shop .woocommerce-pagination,
.tax-product_cat .woocommerce-pagination {
    text-align: center;
    padding: 2rem 0 1rem;
}

.woocommerce-shop .woocommerce-pagination ul.page-numbers,
.tax-product_cat .woocommerce-pagination ul.page-numbers {
    display: inline-flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-shop .woocommerce-pagination .page-numbers li a,
.woocommerce-shop .woocommerce-pagination .page-numbers li span,
.tax-product_cat .woocommerce-pagination .page-numbers li a,
.tax-product_cat .woocommerce-pagination .page-numbers li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: var(--shop-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--shop-gray-600);
    background: var(--shop-gray-100);
    border: 1px solid var(--shop-gray-200);
    transition: all 0.2s ease;
}

.woocommerce-shop .woocommerce-pagination .page-numbers li a:hover,
.tax-product_cat .woocommerce-pagination .page-numbers li a:hover {
    color: var(--shop-green-600);
    border-color: var(--shop-green-600);
    background: var(--shop-green-50);
}

.woocommerce-shop .woocommerce-pagination .page-numbers li span.current,
.tax-product_cat .woocommerce-pagination .page-numbers li span.current {
    color: #fff;
    background: var(--shop-green-600);
    border-color: var(--shop-green-600);
}
