/* ==========================================================================
   WooCommerce Shop Page Styles
   Theme: Noble Graphics
   ========================================================================== */


.archive.woocommerce .site-main {
    padding-top: 40px;
}

/* ==========================================================================
   Product Grid
   ========================================================================== */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
    /* For loading spinner */
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
    content: none;
    display: none;
}

/* Remove WC default floats and margins */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    float: none;
    margin: 0;
    width: 100%;
}

/* ==========================================================================
   Product Card Styles
   ========================================================================== */
.product-card {
    background: transparent;
    border: none;
    transition: transform 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
}

.product-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
}

.product-image {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: contain;
    /* Changed to contain so product icon/image fits nicely inside the wrapper */
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.01);
}

.product-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: #927530;
    /* Olive/Brown color from mockup */
    color: #fff;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 20px;
    /* Pill shape */
    z-index: 2;
}

.product-info {
    padding: 0;
    /* Removed padding */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: left;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 5px 0;
    line-height: 1.4;
}

.product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.product-title a:hover {
    color: var(--wp--preset--color--primary, #98782D);
}

.product-price-action {
    display: block;
    align-self: flex-start;
}

.price-tag,
.price-tag .amount {
    color: #033D2A;
    /* Dark green from mockup */
    font-weight: 700;
    font-size: 1.05rem;
}

.price-tag del .amount {
    color: #999;
    font-size: 0.9rem;
    font-weight: normal;
    margin-right: 5px;
}

.price-tag ins {
    text-decoration: none;
}

@media (max-width: 768px) {
    .product-info {
        padding: 12px;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-badge {
        top: 8px;
        left: 8px;
        padding: 2px 6px;
        font-size: 0.75rem;
        font-weight: 600;
    }
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.woocommerce nav.woocommerce-pagination {
    margin-top: 40px;
    text-align: center;
}

.woocommerce nav.woocommerce-pagination ul {
    display: inline-flex;
    border: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.woocommerce nav.woocommerce-pagination ul li {
    border: none;
    margin: 0;
    padding: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background-color: var(--wp--preset--color--);
    color: var(--wp--preset--color--);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
}

.woocommerce nav.woocommerce-pagination ul li a:focus,
.woocommerce nav.woocommerce-pagination ul li a:hover {
    background-color: var(--wp--preset--color--);
    color: var(--wp--preset--color--);
}

.woocommerce nav.woocommerce-pagination ul li span.current {
    background-color: var(--wp--preset--color--);
    color: var(--wp--preset--color--);
}

/* ==========================================================================
   AJAX Loading State
   ========================================================================== */
.ng-shop-loading {
    opacity: 0.5;
    pointer-events: none;
}

.ng-shop-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid var(--wp--preset--color--);
    border-top: 4px solid var(--wp--preset--color--);
    border-radius: 50%;
    animation: ng-spin 1s linear infinite;
    z-index: 10;
    display: none;
}

.ng-shop-loading+.ng-shop-spinner {
    display: block;
}

@keyframes ng-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==========================================================================
   Shop Page Layout & Offcanvas Sidebar
   ========================================================================== */
.shop-header {
    text-align: center;
    padding: 40px 0;
    margin-bottom: 20px;
}

.shop-header .page-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--wp--preset--color--);
    margin-bottom: 10px;
}

.shop-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 60px;
}

/* Sidebar wrapper */
.shop-sidebar-wrapper {
    width: 280px;
    flex-shrink: 0;
}

.shop-sidebar-content {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eaeaea;
}

/* Main Content */
.shop-main-content {
    flex-grow: 1;
    width: calc(100% - 320px);
}

/* Toolbar (Result count, Sorting, Filter toggle) */
/* .shop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
} */

.shop-toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.woocommerce-result-count {
    margin: 0;
    color: #666;
}

.woocommerce-ordering select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    color: #333;
    cursor: pointer;
}

/* Hide mobile elements on desktop */
.mobile-only {
    display: none;
}

/* ==========================================================================
   Mobile / Tablet Responsive (Offcanvas)
   ========================================================================== */
@media (max-width: 991px) {
    .shop-layout {
        flex-direction: column;
    }

    .shop-main-content {
        width: 100%;
    }

    .mobile-only {
        display: block;
    }

    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .shop-toolbar {
        flex-wrap: wrap;
        gap: 15px;
    }

    .shop-toolbar-right {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    /* Offcanvas Sidebar */
    .shop-sidebar-wrapper.offcanvas-mobile {
        position: fixed;
        top: 0;
        left: -350px;
        width: 320px;
        max-width: 90vw;
        height: 100vh;
        background: #fff;
        z-index: 99999;
        transition: left 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        overflow-y: auto;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
    }

    .shop-sidebar-wrapper.offcanvas-mobile.is-open {
        left: 0;
    }

    .offcanvas-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid #eaeaea;
        background: #fdfdfd;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .offcanvas-header h3 {
        margin: 0;
        font-size: 1.2rem;
    }

    .close-offcanvas-btn {
        background: none;
        border: none;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
        color: #333;
        padding: 0 10px;
    }

    .shop-sidebar-content {
        border: none;
        border-radius: 0;
        padding: 20px;
        flex-grow: 1;
    }

    /* Move sorting dropdown into sidebar visually */
    .shop-sidebar-content .woocommerce-ordering {
        margin-bottom: 30px;
        width: 100%;
    }

    .shop-sidebar-content .woocommerce-ordering select {
        width: 100%;
    }

    .shop-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .shop-overlay.is-active {
        opacity: 1;
        visibility: visible;
    }
}