.cs-product-collections {
    --pc-spacing: 2rem;
    --pc-border-color: #e5e5e5;
    --pc-text-color: #333;
    --pc-active-color: #0073aa;
    --pc-hover-color: #00a0d2;
    --pc-bg-color: #fff;
    
    margin-bottom: var(--pc-spacing);
}

/* Product Grid */
.cs-product-collections .x-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--cs-base-spacing, 2rem);
    margin-bottom: var(--cs-base-spacing, 2rem);
}

/* Product Card */
.cs-product-collections .product-card {
    position: relative;
    display: flex;
    flex-direction: column;
}

.cs-product-collections .product-card-inner {
    position: relative;
    overflow: hidden;
}

.cs-product-collections .product-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.cs-product-collections .product-link:hover {
    text-decoration: none;
    color: inherit;
}

.cs-product-collections .product-link:focus {
    outline: 2px solid #95C6E4;
    outline-offset: 2px;
}

/* Product Images */
.cs-product-collections .product-images {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

/* Single image fallback (existing behavior) */
.cs-product-collections .product-images img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Gallery Structure */
.cs-product-collections .pc-product-gallery {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.cs-product-collections .pc-product-gallery__wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.cs-product-collections .pc-product-gallery__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cs-product-collections .pc-product-gallery__image.flex-active-slide {
    opacity: 1;
}

.cs-product-collections .pc-product-gallery__image:first-child {
    opacity: 1; /* Ensure first image is visible by default */
}

.cs-product-collections .pc-product-gallery__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cs-product-collections .pc-product-gallery__image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Gallery Navigation */
.cs-product-collections .pc-gallery-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.cs-product-collections .product-card:hover .pc-gallery-nav {
    opacity: 1;
}

.cs-product-collections .pc-gallery-prev,
.cs-product-collections .pc-gallery-next {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0 8px;
}

.cs-product-collections .pc-gallery-prev:hover,
.cs-product-collections .pc-gallery-next:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cs-product-collections .pc-gallery-prev svg,
.cs-product-collections .pc-gallery-next svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* Hide navigation when only one image */
.cs-product-collections .pc-product-gallery[data-gallery-source="single"] .pc-gallery-nav {
    display: none;
}

/* Product Gallery Structure */
.cs-product-collections .pc-product-gallery {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.cs-product-collections .pc-product-gallery__wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer; /* Make entire gallery area clickable */
}

.cs-product-collections .pc-product-gallery__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.cs-product-collections .pc-product-gallery__image.flex-active-slide {
    display: block;
}

.cs-product-collections .pc-product-gallery__image:first-child {
    display: block; /* Ensure first image is visible by default */
}

.cs-product-collections .pc-product-gallery__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer; /* Make images clickable */
}

/* Gallery Navigation */
.cs-product-collections .pc-gallery-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.cs-product-collections .product-card:hover .pc-gallery-nav {
    opacity: 1;
}

.cs-product-collections .pc-gallery-prev,
.cs-product-collections .pc-gallery-next {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0 8px;
}

.cs-product-collections .pc-gallery-prev:hover,
.cs-product-collections .pc-gallery-next:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cs-product-collections .pc-gallery-prev svg,
.cs-product-collections .pc-gallery-next svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* Product Colors */
.cs-product-collections .product-colors {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.cs-product-collections .color-swatch {
    width: 1rem;
    height: 1rem;
   /* border-radius: 50%; */
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Fix focus issues for swatches and gallery elements */
.cs-product-collections .swatch-label {
    outline: none !important;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cs-product-collections .swatch-label:focus {
    outline: none !important;
    box-shadow: none !important; /* Remove even the custom focus indicator */
}

.cs-product-collections .swatch-label:active {
    outline: none !important;
    box-shadow: none !important; /* Remove focus during click */
}

.cs-product-collections .swatch-label:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.cs-product-collections .swatch-label.selected {
    border: 2px solid #000 !important;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
    transform: scale(1.05);
}

/* Image swatch specific styles */
.cs-product-collections .image-swatch {
    overflow: hidden;
    /* border-radius: 4px; */ /* Removed rounded corners as requested */
}

.cs-product-collections .image-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Tooltip for swatches */
.cs-product-collections .swatch-label:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 1;
    pointer-events: none;
}

.cs-product-collections .swatch-label::after {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Fix gallery navigation focus */
.cs-product-collections .pc-gallery-prev,
.cs-product-collections .pc-gallery-next {
    outline: none !important;
}

.cs-product-collections .pc-gallery-prev:focus,
.cs-product-collections .pc-gallery-next:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(149, 198, 228, 0.5) !important;
}

/* Remove any default focus outlines from gallery elements */
.cs-product-collections .pc-product-gallery *:focus {
    outline: none !important;
}

.cs-product-collections .pc-product-gallery__image a:focus {
    outline: 2px solid rgba(149, 198, 228, 0.5) !important;
    outline-offset: 2px;
}

/* Remove focus outlines from all product card elements */
.cs-product-collections .product-card *:focus {
    outline: none !important;
}

.cs-product-collections .product-card:focus {
    outline: none !important;
}

.cs-product-collections .x-slide:focus {
    outline: none !important;
}

/* Remove focus from slide container elements */
.cs-product-collections .x-slide-container-viewport:focus,
.cs-product-collections .x-slide-container:focus,
.cs-product-collections .x-slide:focus {
    outline: none !important;
}

/* Target the specific slide container that has keyboard navigation */
.cs-product-collections .x-slide-container-viewport[data-x-slide-container] {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.cs-product-collections .x-slide-container-viewport[data-x-slide-container]:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.cs-product-collections .x-slide-container-viewport[data-x-slide-container]:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remove focus from elements with data-x-slide attribute */
.cs-product-collections [data-x-slide] {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.cs-product-collections [data-x-slide]:focus,
.cs-product-collections [data-x-slide]:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Specifically target the blue line that appears at the top */
.cs-product-collections .product-card::before,
.cs-product-collections .x-slide::before {
    display: none !important;
}

/* Remove any box-shadow that might create blue lines */
.cs-product-collections .product-card,
.cs-product-collections .x-slide {
    box-shadow: none !important;
}

.cs-product-collections .product-card:focus,
.cs-product-collections .x-slide:focus {
    box-shadow: none !important;
}

.cs-product-collections .product-card:active,
.cs-product-collections .x-slide:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remove active state focus from all elements */
.cs-product-collections *:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Aggressively remove any blue lines/borders that might appear */
.cs-product-collections * {
    outline: none !important;
}

.cs-product-collections *:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Target specific elements that might have blue focus indicators */
.cs-product-collections .x-slide-container-viewport,
.cs-product-collections .x-slide-container,
.cs-product-collections .x-slide,
.cs-product-collections .product-card {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.cs-product-collections .x-slide-container-viewport:focus,
.cs-product-collections .x-slide-container:focus,
.cs-product-collections .x-slide:focus,
.cs-product-collections .product-card:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Product Info */
.cs-product-collections .product-title {
    font-size: 1.1em;
    margin: 0 0 0.5rem;
    font-weight: 500;
    text-align: center;
    
    /* Text truncation with ellipsis (single line) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cs-product-collections .product-price {
    font-size: 1em;
    color: #666;
    text-align: center;
}

.cs-product-collections .product-price del {
    color: #999;
    margin-right: 0.5rem;
}

.cs-product-collections .product-price ins {
    text-decoration: none;
    color: #333;
    font-weight: 500;
}

/* Tabs */
.cs-product-collections .x-tabs-list {
    margin-bottom: var(--cs-base-spacing, 2rem);
    border-bottom: none;
}

.cs-product-collections .x-tabs-list ul {
    display: flex;
    justify-content: center;
    gap: 1rem;
    list-style: none;
    margin: 0 auto;
    padding: 0;
    width: fit-content;
}

.cs-product-collections .x-tabs-list button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: var(--cs-text-muted, #666);
    cursor: pointer;
    font-size: var(--cs-font-size-base, 1rem);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    outline: none;
}

.cs-product-collections .x-tabs-list button:focus {
    outline: none;
}

.cs-product-collections .x-tabs-list button:hover {
    color: var(--cs-text-color, #333);
}

.cs-product-collections .x-tabs-list button.x-active {
    background-color: var(--cs-primary-color, #8BB6D1);
    color: #fff;
    font-weight: 500;
}

/* Remove the underline that was previously added */
.cs-product-collections .x-tabs-list button.x-active::after {
    display: none;
}

/* No-tabs mode styling */
.cs-product-collections .x-tabs-list:empty,
.cs-product-collections .x-tabs-list:has(ul:empty) {
    display: none !important;
}

.cs-product-collections .x-tabs-list ul:empty {
    display: none;
}

/* Adjust spacing when no tabs are present */
.cs-product-collections:not(:has(.x-tabs-list ul li)) .cspc-toolbar {
    margin-bottom: var(--cs-base-spacing, 2rem);
}

/* Ensure content looks good without tabs */
.cs-product-collections:not(:has(.x-tabs-list ul li)) .cspc-content {
    margin-top: 0;
}

/* Fallback for browsers that don't support :has() */
.cs-product-collections .x-tabs-list.cspc-no-tabs {
    display: none !important;
}

.cs-product-collections.cspc-no-tabs .cspc-toolbar {
    margin-bottom: var(--cs-base-spacing, 2rem);
}

.cs-product-collections.cspc-no-tabs .cspc-content {
    margin-top: 0;
}

/* Responsive Tabs */
@media (max-width: 768px) {
    .cs-product-collections .x-tabs-list {
        margin-bottom: var(--cs-base-spacing-sm, 1.5rem);
    }

    .cs-product-collections .x-tabs-list ul {
        gap: 0.75rem;
    }

    .cs-product-collections .x-tabs-list button {
        padding: 0.5rem 1rem;
        font-size: var(--cs-font-size-sm, 0.9rem);
    }
}

@media (max-width: 480px) {
    .cs-product-collections .x-tabs-list ul {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .cs-product-collections .x-tabs-list button {
        width: 100%;
        text-align: center;
    }
}

/* Toolbar */
.cs-product-collections .cspc-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
    transition: opacity 0.3s ease;
}

.cs-product-collections .cspc-toolbar.hide-sort {
    display: none;
}

.cs-product-collections .cspc-sort {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    color: #333;
    min-width: 200px;
    font-size: 0.9rem;
}

/* Loading State */
.cs-product-collections .cspc-content.loading {
    opacity: 0.5;
    pointer-events: none;
}

.cs-product-collections .cspc-loading {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 200px;
    padding-top: 40px;
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.cs-product-collections .cspc-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #ccc;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Overlay Loading State */
.cs-product-collections .cspc-content {
    position: relative;
}

.cs-product-collections .cspc-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 300px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    z-index: 10;
    transition: opacity 0.3s ease;
    border-radius: 4px;
}

/* Remove the old overlay-specific styles since we're using nested cspc-loading */
.cs-product-collections .cspc-loading-overlay::before {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .cs-product-collections .x-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--cs-base-spacing-sm, 1.5rem);
    }
}

@media (max-width: 364px) {
    .cs-product-collections .x-grid {
        grid-template-columns: 1fr;
        gap: var(--cs-base-spacing-xs, 1rem);
    }

    .cs-product-collections .cspc-toolbar {
        margin-bottom: var(--cs-base-spacing-sm, 1.5rem);
    }

    .cs-product-collections .cspc-sort {
        width: 100%;
    }
}

.cspc-no-products {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--pc-spacing) !important;
    margin: calc(var(--pc-spacing) / 2) 0;
    background-color: var(--pc-bg-color) !important;
    border: 1px solid var(--pc-border-color) !important;
    border-radius: 4px;
}

.cspc-no-products-icon {
    display: block;
    margin-bottom: calc(var(--pc-spacing) / 2);
    color: var(--pc-text-color);
    opacity: 0.6;
}

.cspc-no-products-message {
    display: block;
    font-size: 1.1em;
    margin-bottom: calc(var(--pc-spacing) / 4);
    color: var(--pc-text-color);
}

.cspc-no-products-suggestion {
    display: block;
    font-size: 0.9em;
    color: var(--pc-text-color);
    opacity: 0.7;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .cspc-no-products {
        padding: calc(var(--pc-spacing) * 0.75) !important;
    }
    
    .cspc-no-products-icon svg {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .cspc-no-products {
        padding: calc(var(--pc-spacing) * 0.5) !important;
    }
    
    .cspc-no-products-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .cspc-no-products-message {
        font-size: 1em;
    }
    
    .cspc-no-products-suggestion {
        font-size: 0.85em;
    }
}

/* Pagination */
.cs-product-collections .cspc-pagination {
    margin-top: var(--cs-base-spacing, 2rem);
    display: flex;
    justify-content: center;
    align-items: center;
}

.cs-product-collections .cspc-pagination ul.page-numbers {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cs-product-collections .cspc-pagination .page-numbers a,
.cs-product-collections .cspc-pagination .page-numbers span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 5px;
    font-size: var(--cs-font-size-base, 1rem);
    text-decoration: none;
    border: 1px solid var(--cs-border-color, #e5e5e5);
    color: var(--cs-text-color, #333);
    background: var(--cs-bg-color, #fff);
    transition: all 0.2s ease;
}

.cs-product-collections .cspc-pagination .page-numbers.current {
    background-color: var(--cs-primary-color, #8BB6D1);
    border-color: var(--cs-primary-color, #8BB6D1);
    color: #fff;
}

.cs-product-collections .cspc-pagination .page-numbers.prev,
.cs-product-collections .cspc-pagination .page-numbers.next {
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--cs-border-color, #e5e5e5);
    background: var(--cs-bg-color, #fff);
    position: relative;
    font-size: 0;
}

.cs-product-collections .cspc-pagination .page-numbers.prev::before,
.cs-product-collections .cspc-pagination .page-numbers.next::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-style: solid;
    border-width: 2px 2px 0 0;
    border-color: var(--cs-text-color, #333);
    top: 50%;
    left: 50%;
    transition: border-color 0.2s ease;
}

.cs-product-collections .cspc-pagination .page-numbers.next::before {
    transform: translate(-60%, -50%) rotate(45deg);
}

.cs-product-collections .cspc-pagination .page-numbers.prev::before {
    transform: translate(-40%, -50%) rotate(-135deg);
}

.cs-product-collections .cspc-pagination .page-numbers.prev:hover::before,
.cs-product-collections .cspc-pagination .page-numbers.next:hover::before {
    border-color: var(--cs-primary-color, #8BB6D1);
}

.cs-product-collections .cspc-pagination .page-numbers.prev:hover,
.cs-product-collections .cspc-pagination .page-numbers.next:hover {
    border-color: var(--cs-primary-color, #8BB6D1);
}

/* Update responsive styles for arrows */
@media (max-width: 480px) {
    .cs-product-collections .cspc-pagination .page-numbers.prev,
    .cs-product-collections .cspc-pagination .page-numbers.next {
        min-width: 35px;
        height: 35px;
    }

    .cs-product-collections .cspc-pagination .page-numbers.prev::before,
    .cs-product-collections .cspc-pagination .page-numbers.next::before {
        width: 6px;
        height: 6px;
    }
}

/* Update pagination hover effects */
.cs-product-collections .cspc-pagination .page-numbers a:hover {
    border-color: var(--cs-primary-color, #8BB6D1);
    color: var(--cs-primary-color, #8BB6D1);
    background-color: var(--cs-bg-color, #fff);
}

/* Product Title Ellipsis - Template Specific */
.cs-product-collections .x-text-headline.heading6 .x-text-content-text-primary,
.cs-product-collections .x-text-headline.heading6 h6 {
    /* Text truncation with ellipsis (single line) */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    display: block !important;
}

.cs-product-collections .x-text-headline.heading6 .x-text-content-text-primary div,
.cs-product-collections .x-text-headline.heading6 h6 div {
    /* Ensure the inner div also respects truncation */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    letter-spacing: .5pt !important;
    font-weight: 500 !important;
}

.cs-product-collections .cspc-pagination .page-numbers.current:hover {
    border-color: var(--cs-primary-color, #8BB6D1);
    background-color: var(--cs-primary-color, #8BB6D1);
    color: #fff;
}

.cs-product-collections span.woocommerce-Price-amount {
    font-size: 12pt !important;
    letter-spacing: .5pt !important;
}

.cs-product-collections  .product-price-format {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1px;
}