/* Product grid */

.store-products-grid,
#products-grid {
    display: grid;
    grid-template-columns: var(--store-grid-columns-desktop);
    gap: var(--store-grid-gap);
    align-items: stretch;
}

.store-gallery-grid {
    margin: 0;
}

[data-store-pagination-wrap],
.store-legacy-pagination-wrap {
    margin-top: var(--store-space-10);
}

[data-store-pagination-wrap]:empty,
.store-legacy-pagination-wrap:empty {
    display: none;
}

.store-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--store-space-3);
    flex-wrap: wrap;
}

.store-pagination-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--store-space-2);
    flex-wrap: wrap;
}

.store-pagination-button,
.store-pagination-ellipsis {
    min-width: 40px;
    min-height: 40px;
    padding: 0 var(--store-space-4);
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1;
}

.store-pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--store-color-border);
    background: var(--store-color-white);
    color: var(--store-color-text);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color var(--store-transition-fast),
        border-color var(--store-transition-fast),
        color var(--store-transition-fast),
        box-shadow var(--store-transition-fast),
        transform var(--store-transition-fast);
}

.store-pagination-button:hover {
    border-color: var(--store-color-primary-pale);
    background: var(--store-color-surface-soft);
    color: var(--store-color-primary);
    transform: translateY(-1px);
}

.store-pagination-button:focus-visible {
    outline: none;
    border-color: var(--store-color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.store-pagination-button.is-active {
    border-color: var(--store-color-primary);
    background: var(--store-color-primary);
    color: var(--store-color-white);
    box-shadow: var(--store-shadow-button);
}

.store-pagination-button.is-active:hover {
    color: var(--store-color-white);
    transform: none;
}

.store-pagination-button.is-disabled,
.store-pagination-button:disabled {
    border-color: var(--store-color-border-strong);
    background: #f8fafc;
    color: var(--store-color-text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.store-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--store-color-text-muted);
    font-weight: 600;
}

/* Product card */

.product-card {
    position: relative;
    display: flex;
    height: 100%;
    background: var(--store-color-white);
    border: 1px solid var(--store-color-border);
    border-radius: var(--store-radius-card);
    overflow: hidden;
    box-shadow: var(--store-shadow-card);
    transition:
        transform var(--store-transition-base),
        box-shadow var(--store-transition-base),
        border-color var(--store-transition-base);
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: #c7d2fe;
    box-shadow: var(--store-shadow-card-hover);
}

.product-card-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 100%;
    gap: var(--store-space-5);
    padding: var(--store-space-6);
}

.product-card-media-link,
.product-card-title-link {
    text-decoration: none;
    color: inherit;
}

.product-card-media-link {
    display: block;
}

.product-card-title-link {
    display: block;
}

.product-card-media {
    position: relative;
    aspect-ratio: var(--store-product-image-ratio);
    overflow: hidden;
    background: var(--store-color-white);
}

.product-card-sale-badge {
    position: absolute;
    top: var(--store-space-4);
    left: var(--store-space-4);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 var(--store-space-4);
    border-radius: var(--store-radius-pill);
    background: var(--store-color-primary);
    color: var(--store-action-button-text, #ffffff);
    -webkit-text-fill-color: currentColor;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: var(--store-shadow-button);
    pointer-events: none;
}

.product-card-image-stack,
.product-card-image-layer {
    position: absolute;
    inset: 0;
}

.product-card-image-layer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--store-space-4);
    transition:
        opacity 0.3s ease,
        transform var(--store-transition-slow);
}

.product-card-image-layer.is-secondary {
    opacity: 0;
    transform: scale(1.035);
}

.product-card-image-asset {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: scale-down;
    object-position: center;
    transform: translateZ(0);
    filter: none;
    transition:
        transform var(--store-transition-slow),
        filter var(--store-transition-slow);
}

.product-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    gap: var(--store-space-3);
    min-width: 0;
}

.product-card-title {
    margin: 0;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.45;
    letter-spacing: 0;
    color: var(--store-color-title);
    font-weight: 400;
    display: block;
    overflow: visible;
    white-space: normal;
    overflow-wrap: break-word;
}

.product-card-title-link:hover .product-card-title {
    color: var(--store-color-primary);
}

.product-card-price-row {
    display: flex;
    align-items: flex-end;
    gap: var(--store-space-3);
    margin-top: auto;
    padding-top: var(--store-space-1);
}

.product-card .price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 400;
    color: var(--store-color-price);
}

.product-card .price ins {
    text-decoration: none;
    color: var(--store-color-price);
}

.product-card .price del {
    font-size: 0.92rem;
    color: #94a3b8;
}

.product-card-actions {
    display: flex;
    align-items: stretch;
    gap: var(--store-space-3);
    margin-top: var(--store-space-4);
    flex-wrap: wrap;
    width: 100%;
}

.product-card-quantity {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border-radius: 14px;
    border: 1px solid var(--store-color-border);
    background: var(--store-color-surface);
    order: 1;
    flex: 0 0 auto;
}

.product-card-quantity-button {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--store-color-white);
    color: var(--store-color-text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 0;
    cursor: pointer;
    box-shadow: var(--store-shadow-control);
}

.product-card-quantity-button:hover {
    background: var(--store-color-primary-faint);
    color: var(--store-color-primary);
}

.product-card-quantity-input {
    width: 36px;
    min-height: 28px;
    padding: 0;
    border: 0;
    background: var(--store-color-white);
    text-align: center;
    font-weight: 700;
    color: var(--store-color-text);
    appearance: textfield;
}

.product-card-quantity-input:focus {
    outline: none;
}

.product-card-quantity-input::-webkit-outer-spin-button,
.product-card-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-card-out-of-stock-row {
    display: flex;
    align-items: stretch;
    gap: var(--store-space-3);
    order: 2;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
}

.product-card-out-of-stock-row .product-card-button-disabled {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

.store-stock-notify-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--store-color-border);
    border-radius: 14px;
    background: var(--store-color-white);
    color: var(--store-color-text);
    cursor: pointer;
    box-shadow: var(--store-shadow-control);
    transition:
        transform var(--store-transition-fast),
        background-color var(--store-transition-fast),
        border-color var(--store-transition-fast),
        color var(--store-transition-fast);
}

.store-stock-notify-bell:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
}

.store-stock-notify-bell.is-active {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.store-stock-notify-bell.is-active:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

.store-stock-notify-bell.loading {
    opacity: 0.75;
    pointer-events: none;
}

.product-card-button,
.product-card-actions .added_to_cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 var(--store-space-6);
    border-radius: 14px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    transition:
        transform var(--store-transition-fast),
        box-shadow var(--store-transition-fast),
        opacity var(--store-transition-fast);
}

.product-card-button:hover {
    transform: translateY(-1px);
}

.product-card-button-primary {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    background: linear-gradient(135deg, var(--store-action-button-bg-start, #1d4ed8) 0%, var(--store-action-button-bg-end, #2563eb) 100%) !important;
    background-image: linear-gradient(135deg, var(--store-action-button-bg-start, #1d4ed8) 0%, var(--store-action-button-bg-end, #2563eb) 100%) !important;
    color: var(--store-action-button-text, #ffffff) !important;
    -webkit-text-fill-color: var(--store-action-button-text, #ffffff) !important;
    box-shadow: var(--store-action-button-shadow);
}

.product-card-button-primary:hover,
.product-card-button-primary:focus,
.product-card-button-primary:focus-visible {
    color: var(--store-action-button-text, #ffffff) !important;
    -webkit-text-fill-color: var(--store-action-button-text, #ffffff) !important;
    box-shadow: var(--store-action-button-shadow-hover);
}

.product-card-button-secondary,
.product-card-actions .added_to_cart {
    background: var(--store-color-surface-soft);
    color: var(--store-color-primary);
}

.product-card-button-disabled {
    width: 100%;
    background: var(--store-color-disabled-bg);
    color: var(--store-color-disabled-text);
}

.product-card-actions .added_to_cart {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    padding: 0 var(--store-space-5);
    margin-top: var(--store-space-2);
}

.product-card-button.loading {
    opacity: 0.75;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .product-card.has-hover-image:hover .product-card-image-layer.is-primary {
        opacity: 0;
        transform: scale(0.985);
    }

    .product-card.has-hover-image:hover .product-card-image-layer.is-secondary {
        opacity: 1;
        transform: scale(1);
    }

    .product-card:hover .product-card-image-layer.is-primary .product-card-image-asset {
        transform: scale(1.02);
        filter: drop-shadow(0 20px 34px rgba(15, 23, 42, 0.16));
    }
}

/* States */

.store-empty-state {
    margin: 0;
    padding: var(--store-space-11);
    border: 1px dashed #d1d5db;
    border-radius: var(--store-radius-panel);
    background: var(--store-color-white);
    color: #4b5563;
    text-align: center;
}

.store-shell.is-loading .store-products-grid {
    opacity: 0.55;
    transition: opacity var(--store-transition-fast);
}

/* Category landing: breadcrumb + subcategories */

.store-breadcrumb {
    margin: 0 0 var(--store-space-6);
}

.store-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--store-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
    color: var(--store-color-text-soft, #6b7280);
}

.store-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: var(--store-space-2);
}

.store-breadcrumb-item + .store-breadcrumb-item::before {
    content: '/';
    color: var(--store-color-text-muted, #64748b);
    font-weight: 400;
}

.store-breadcrumb-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.store-breadcrumb-current {
    font-weight: 600;
    color: var(--store-color-text, #0f172a);
}

.store-landing-title {
    margin: 0 0 var(--store-space-6);
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 700;
    color: var(--store-color-text-strong, #111827);
}

.store-landing-title:has(+ .store-landing-intro) {
    margin-bottom: var(--store-space-3);
}

.store-landing-intro {
    margin: 0 0 var(--store-space-6);
    max-width: 70ch;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--store-color-text-soft, #6b7280);
}

html[data-store-theme="dark"] .store-shell .store-landing-title,
html[data-store-theme="dark"] .store-shell .store-landing-title {
    color: var(--store-color-text-strong, #f1f5f9) !important;
    -webkit-text-fill-color: var(--store-color-text-strong, #f1f5f9) !important;
}

html[data-store-theme="dark"] .store-shell .store-landing-intro,
html[data-store-theme="dark"] .store-shell .store-breadcrumb-list,
html[data-store-theme="dark"] .store-shell .store-breadcrumb-link,
html[data-store-theme="dark"] .store-shell .store-breadcrumb-link {
    color: var(--store-color-text-soft, #e2e8f0) !important;
    -webkit-text-fill-color: var(--store-color-text-soft, #e2e8f0) !important;
}

html[data-store-theme="dark"] .store-shell .store-breadcrumb-current,
html[data-store-theme="dark"] .store-shell .store-breadcrumb-current {
    color: var(--store-color-text, #f8fafc) !important;
    -webkit-text-fill-color: var(--store-color-text, #f8fafc) !important;
}

.store-subcategories-group {
    margin-bottom: var(--store-space-4);
    color: var(--store-color-text-soft);
}

.store-subcategories-content.filter-content {
    max-height: none;
    overflow: visible;
}

.store-subcategories-list,
.store-subcategories-tree {
    margin: 0;
    padding: 0;
    list-style: none;
    color: inherit;
}

.store-subcategories-tree--nested {
    margin-top: var(--store-space-2);
    padding-left: var(--store-space-5);
    border-left: 1px solid var(--store-color-border);
}

.store-subcategories-item,
.store-subcategories-leaf,
.store-subcategories-branch {
    margin: 0 0 var(--store-space-2);
    font-size: 0.875rem;
    color: inherit;
}

.store-subcategories-branch-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--store-space-3);
    width: 100%;
    min-width: 0;
    padding: var(--store-space-2) 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: inherit;
    -webkit-text-fill-color: currentColor !important;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.store-subcategories-branch-label {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.35;
}

.store-subcategories-branch-toggle .arrow {
    flex-shrink: 0;
    align-self: center;
    margin-left: var(--store-space-2);
    font-size: 0.9rem;
    line-height: 1;
    color: var(--store-color-text-muted);
}

.store-subcategories-branch-toggle:hover,
.store-subcategories-branch-toggle:focus,
.store-subcategories-branch-toggle:focus-visible,
.store-subcategories-branch-toggle:active {
    color: var(--store-color-primary);
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-text-fill-color: currentColor !important;
}

html[data-store-theme="dark"] .store-filters-panel .store-subcategories-branch-toggle,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore {
    background: transparent !important;
    background-image: none !important;
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

html[data-store-theme="dark"] .store-filters-panel .store-subcategories-branch-toggle:hover,
html[data-store-theme="dark"] .store-filters-panel .store-subcategories-branch-toggle:focus,
html[data-store-theme="dark"] .store-filters-panel .store-subcategories-branch-toggle:focus-visible,
html[data-store-theme="dark"] .store-filters-panel .store-subcategories-branch-toggle:active,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore:hover,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore:focus,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore:focus-visible,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore:active,
html[data-store-theme="dark"] .store-subcategories-branch-toggle.wp-dark-mode-ignore:active {
    background: transparent !important;
    background-image: none !important;
    color: var(--store-color-primary) !important;
    -webkit-text-fill-color: currentColor !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.store-subcategories-branch-toggle:hover .arrow,
.store-subcategories-branch-toggle:focus-visible .arrow {
    color: inherit;
}

.store-subcategories-branch.is-expanded > .store-subcategories-branch-toggle .arrow {
    transform: rotate(180deg);
}

.store-subcategories-branch-panel {
    display: none;
    padding-bottom: var(--store-space-2);
}

.store-subcategories-branch.is-expanded > .store-subcategories-branch-panel {
    display: block;
}

.store-subcategories-link,
.store-subcategories-view-all {
    display: block;
    padding: var(--store-space-2) 0;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.store-subcategories-view-all {
    margin-top: var(--store-space-2);
    padding-top: var(--store-space-3);
    border-top: 1px solid var(--store-color-border);
    font-weight: 600;
    color: var(--store-color-primary);
}

.store-subcategories-current {
    display: block;
    padding: var(--store-space-2) 0;
    font-weight: 600;
    color: var(--store-color-text);
}

.store-subcategories-branch.is-current > .store-subcategories-branch-toggle,
.store-subcategories-leaf.is-current .store-subcategories-current {
    color: var(--store-color-primary);
}

.store-landing-bottom-description {
    display: block;
    clear: both;
    margin-top: clamp(32px, 6vw, 48px);
    margin-bottom: clamp(24px, 4vw, 36px);
    padding: var(--store-space-6) var(--store-space-8);
    background: var(--store-color-surface-soft, #f8fafc);
    border: 1px solid var(--store-color-border, #e2e8f0);
    border-radius: var(--store-radius-card, 16px);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--store-color-text-soft, #6b7280);
}

.store-landing-bottom-description p {
    margin: 0 0 var(--store-space-4);
}

.store-landing-bottom-description p:last-child {
    margin-bottom: 0;
}

html[data-store-theme="dark"] .store-landing-bottom-description,
html[data-store-theme="dark"] .store-landing-bottom-description {
    background: rgba(30, 41, 59, 0.4);
    border-color: #334155;
    color: var(--store-color-text-soft, #e2e8f0) !important;
    -webkit-text-fill-color: var(--store-color-text-soft, #e2e8f0) !important;
}

/* Product Ratings */
.store-product-rating {
    display: inline-flex;
    align-items: center;
    gap: var(--store-space-2, 8px);
    margin-bottom: var(--store-space-2, 8px);
    font-size: 0.85rem;
    line-height: 1;
}

.store-product-rating__stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.store-product-rating__star {
    width: 14px;
    height: 14px;
    display: block;
}

.store-product-rating__star.is-filled {
    color: #f59e0b; /* Amber 500 */
    fill: #f59e0b;
}

.store-product-rating__star.is-empty {
    color: #cbd5e1; /* Slate 300 */
    fill: none;
}

.store-product-rating__star-half-container {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 1;
}

.store-product-rating__star-half-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    overflow: hidden;
    color: #f59e0b;
    fill: #f59e0b;
}

.store-product-rating__count {
    color: var(--store-color-text-muted, #94a3b8);
    font-weight: 500;
}

/* Catalog specific positioning */
.product-card .store-product-rating {
    margin-top: var(--store-space-1, 4px);
    margin-bottom: var(--store-space-2, 8px);
}

/* Side Cart specific styling */
.store-side-cart-item-rating .store-product-rating {
    margin-top: var(--store-space-1, 4px);
    margin-bottom: var(--store-space-1, 4px);
    font-size: 0.8rem;
}

.store-side-cart-item-rating .store-product-rating__star {
    width: 12px;
    height: 12px;
}

.store-side-cart-item-rating .store-product-rating__star-half-container {
    width: 12px;
    height: 12px;
}

/* Dark mode overrides for ratings */
html[data-store-theme="dark"] .store-product-rating__star.is-empty,
html[data-store-theme="dark"] .store-product-rating__star.is-empty {
    color: #475569; /* Slate 600 in dark mode */
}

