:root {
    --spa-orange: #ff6600;
    --spa-orange-dark: #e85d00;
    --spa-green: #79bd2a;
    --spa-text: #3d3d3d;
    --spa-muted: #555555;
    --spa-border: #dddddd;
    --spa-white: #ffffff;
}

/* Grid reset / reference layout */
.woocommerce .spa-products-grid,
.spa-products-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.woocommerce ul.products.spa-products-grid::before,
.woocommerce ul.products.spa-products-grid::after { display: none !important; content: none !important; }
.woocommerce ul.products.spa-products-grid > li.product,
.spa-products-grid > .spa-grid-item {
    float: none !important;
    clear: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.spa-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 630px;
    overflow: hidden;
    background: var(--spa-white);
    border-style: solid;
    border-width: 1px;
    border-color: var(--spa-border);
    border-radius: 0;
    box-sizing: border-box;
    transition: box-shadow .2s ease, transform .2s ease;
}
.spa-product-card * { box-sizing: border-box; }

.spa-product-media {
    position: relative;
    height: 350px;
    overflow: hidden;
    background: #fff;
}
.spa-product-image-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 16px;
    overflow: hidden;
}
.spa-product-image {
    position: absolute;
    inset: 16px;
    width: calc(100% - 32px) !important;
    height: calc(100% - 32px) !important;
    max-width: none !important;
    margin: 0 !important;
    object-fit: contain;
    object-position: center;
    transition: opacity .35s ease, transform .45s ease;
}
.spa-product-image-hover { opacity: 0; }
.spa-hover-swap .spa-product-card:hover .spa-product-image-primary,
.spa-elementor-archive-widget:not(.spa-hover-zoom):not(.spa-hover-none) .spa-product-card:hover .spa-product-image-primary { opacity: 0; }
.spa-hover-swap .spa-product-card:hover .spa-product-image-hover,
.spa-elementor-archive-widget:not(.spa-hover-zoom):not(.spa-hover-none) .spa-product-card:hover .spa-product-image-hover { opacity: 1; }
.spa-hover-zoom .spa-product-card:hover .spa-product-image-primary { transform: scale(1.05); }
.spa-hover-zoom .spa-product-image-hover,
.spa-hover-none .spa-product-image-hover { display: none; }

.spa-badges {
    position: absolute;
    z-index: 4;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    pointer-events: none;
}
.spa-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 0;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}
.spa-featured-badge { background: var(--spa-orange); }
.spa-sale-badge { background: #222; }

.spa-gallery-progress {
    position: absolute;
    z-index: 4;
    right: 18px;
    bottom: 5px;
    left: 18px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #555;
    font-size: 12px;
    line-height: 1;
}
.spa-gallery-line {
    position: relative;
    display: block;
    height: 2px;
    flex: 1;
    background: #ddd;
}
.spa-gallery-line i {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 25%;
    height: 2px;
    background: #222;
}
.spa-gallery-count { flex: 0 0 auto; }

.spa-product-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 22px 20px;
    text-align: center;
}
.spa-rating-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 17px;
    margin: 0 0 7px;
    line-height: 1;
}
.spa-stars {
    position: relative;
    display: inline-block;
    overflow: hidden;
    color: #d8d8d8;
    font-size: 12px;
    letter-spacing: 1px;
    line-height: 1;
    white-space: nowrap;
}
.spa-stars b { color: #d8d8d8; font-style: normal; font-weight: 400; }
.spa-stars i {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    overflow: hidden;
    color: #ffb400;
    font-style: normal;
    font-weight: 400;
    white-space: nowrap;
}
.spa-rating-count { color: #777; font-size: 11px; }
.spa-product-title {
    width: 100%;
    min-height: 48px;
    margin: 0 0 6px;
    color: var(--spa-text);
    font-size: 19px;
    font-weight: 400;
    line-height: 1.22;
    text-align: center;
}
.spa-product-title a { color: inherit; text-decoration: none; transition: color .18s ease; }
.spa-product-title a:hover { color: var(--spa-orange); }
.spa-stock {
    margin-top: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}
.spa-stock.is-in-stock { color: var(--spa-green); }
.spa-stock.is-out-stock { color: #d63638; }
.spa-price {
    margin-top: auto;
    padding-top: 22px;
    color: #111;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}
.spa-price del { margin-right: 6px; color: #8a8a8a; font-size: .86em; font-weight: 400; opacity: 1; }
.spa-price ins { color: inherit; font-weight: inherit; text-decoration: none; }

.spa-secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 65px;
    margin-top: auto;
    border-top: 1px solid transparent;
}
.spa-text-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 13px;
    border: 0;
    background: transparent;
    color: #555;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: color .18s ease;
}
.spa-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
}
.spa-action-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #444;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke .18s ease;
}
.spa-text-action:hover,
.spa-text-action.is-active { background: var(--spa-orange); color: #fff; }
.spa-text-action:hover svg,
.spa-text-action.is-active svg { stroke: #fff; }

.spa-primary-actions {
    display: grid;
    grid-template-columns: 45% 55%;
    min-height: 52px;
    border-top: 1px solid transparent;
}
.spa-quick-view-btn,
.spa-add-to-cart {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    margin: 0 !important;
    padding: 10px 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none !important;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}
.spa-quick-view-btn {
    background: #fff;
    color: #555;
}
.spa-quick-view-btn:hover { background: var(--spa-orange); color: #fff; }
.spa-add-to-cart,
.woocommerce .spa-add-to-cart.button {
    background: var(--spa-orange) !important;
    color: #fff !important;
}
.spa-add-to-cart:hover,
.woocommerce .spa-add-to-cart.button:hover { background: var(--spa-orange-dark) !important; color: #fff !important; }
.spa-cart-placeholder {
    display: block;
    min-height: 52px;
    width: 100%;
    background: #fff;
}
.spa-cart-icon { display: inline-flex; width: 27px; height: 27px; }
.spa-cart-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Pagination */
.spa-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin: 28px 0 0;
}
.spa-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 0;
    background: #fff;
    color: #333;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
}
.spa-pagination .page-numbers.current {
    border-color: var(--spa-orange);
    background: var(--spa-orange);
    color: #fff;
}
.spa-pagination a.page-numbers:hover { border-color: var(--spa-orange); color: var(--spa-orange); }

/* Quick View modal */
body.spa-modal-open { overflow: hidden; }
.spa-modal {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.spa-modal.is-open { display: flex; }
.spa-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.58); }
.spa-modal-dialog {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    max-height: calc(100vh - 48px);
    margin: 0;
    overflow: auto;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.spa-modal-close {
    position: sticky;
    z-index: 10;
    top: 12px;
    float: right;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 12px 12px -52px 0;
    padding: 0;
    border: 1px solid #e2e2e2;
    border-radius: 50%;
    background: #fff;
    color: #222;
    box-shadow: 0 3px 14px rgba(0,0,0,.14);
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}
.spa-modal-close:hover { background: var(--spa-orange); border-color: var(--spa-orange); color: #fff; }
.spa-modal-close svg { display: none; }
.spa-modal-body { padding: 34px; }
.spa-modal-loading, .spa-empty { padding: 50px 20px; color: #666; text-align: center; }
.spa-qv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; }
.spa-qv-main-image { display: flex; align-items: center; justify-content: center; min-height: 420px; background: #fafafa; }
.spa-qv-main-image img { width: 100%; max-height: 520px; object-fit: contain; }
.spa-qv-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.spa-qv-thumb { width: 64px; height: 64px; padding: 3px; border: 1px solid #ddd; background: #fff; cursor: pointer; }
.spa-qv-thumb.is-active { border-color: var(--spa-orange); }
.spa-qv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.spa-qv-summary h2 { margin: 5px 0 10px; color: #333; font-size: 28px; line-height: 1.25; }
.spa-qv-price { margin: 14px 0 18px; color: #111; font-size: 22px; font-weight: 700; }
.spa-qv-description { color: #555; font-size: 14px; line-height: 1.65; }
.spa-qv-cart { margin: 22px 0; }
.spa-qv-cart form.cart { display: flex; gap: 10px; align-items: stretch; }
.spa-qv-cart .quantity .qty { min-height: 44px; }
.spa-qv-cart .button { min-height: 44px; border-radius: 0 !important; background: var(--spa-orange) !important; color: #fff !important; }
.spa-qv-details-link { color: var(--spa-orange); font-weight: 600; text-decoration: none; }

/* Local wishlist/compare UI */
.spa-collection-title { margin: 0 0 20px; color: #333; font-size: 24px; }
.spa-collection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.spa-collection-item { position: relative; overflow: hidden; border: 1px solid #ddd; background: #fff; }
.spa-collection-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fafafa; }
.spa-collection-item-info { padding: 12px; }
.spa-collection-item-name { display: block; color: #333; font-size: 14px; font-weight: 600; line-height: 1.4; text-decoration: none; }
.spa-collection-item-price { display: block; margin-top: 5px; color: #666; font-size: 13px; }
.spa-collection-remove { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(255,255,255,.96); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.spa-toast {
    position: fixed;
    z-index: 1000000;
    right: 22px;
    bottom: 22px;
    padding: 12px 16px;
    border-radius: 3px;
    background: #20262d;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: .2s ease;
}
.spa-toast.is-visible { opacity: 1; transform: translateY(0); }

/* Native archive defaults */
.woocommerce ul.products.spa-native-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 0 !important; }

@media (max-width: 1024px) {
    .woocommerce ul.products.spa-native-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .spa-product-media { height: 310px; }
    .spa-product-card { min-height: 590px; }
}

@media (max-width: 767px) {
    .woocommerce ul.products.spa-native-grid { grid-template-columns: 1fr !important; }
    .spa-product-media { height: 300px; }
    .spa-product-card { min-height: 560px; }
    .spa-product-title { font-size: 17px; }
    .spa-product-main { padding-right: 16px; padding-left: 16px; }
    .spa-secondary-actions { min-height: 58px; }
    .spa-text-action { gap: 7px; padding: 8px; font-size: 13px; }
    .spa-action-icon { width: 23px; height: 23px; }
    .spa-primary-actions { grid-template-columns: 44% 56%; }
    .spa-quick-view-btn, .spa-add-to-cart { min-height: 50px; padding: 8px !important; font-size: 13px; }
    .spa-cart-icon { width: 22px; height: 22px; }
    .spa-modal-body { padding: 22px; }
    .spa-qv-layout { grid-template-columns: 1fr; gap: 22px; }
    .spa-qv-main-image { min-height: 300px; }
    .spa-collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
    .spa-product-media { height: 275px; }
    .spa-product-title { min-height: 42px; font-size: 16px; }
    .spa-price { padding-top: 16px; }
    .spa-secondary-actions { grid-template-columns: 1fr 1fr; }
    .spa-text-action span:last-child { font-size: 12px; }
    .spa-collection-grid { grid-template-columns: 1fr; }
}

/* v2.1 alignment refinements */
.spa-secondary-actions > .spa-text-action + .spa-text-action { border-left: 1px solid var(--spa-border); }
.spa-primary-actions > * + * { border-left: 1px solid var(--spa-border); }
.spa-primary-actions { align-items: stretch; }
.spa-primary-actions > * { width: 100%; height: 100%; }
.spa-product-card .spa-product-main { min-height: 205px; }
.spa-qv-summary { align-self: center; }
@media (max-width: 767px) {
    .spa-modal { padding: 12px; }
    .spa-modal-dialog { max-height: calc(100vh - 24px); }
    .spa-modal-close { top: 8px; margin: 8px 8px -48px 0; }
}

/* v2.2.0: exact action-row alignment + equal button cells */
.spa-products-grid > .spa-grid-item,
.woocommerce ul.products.spa-products-grid > li.product {
    display: flex !important;
    align-items: stretch;
}
.spa-products-grid .spa-product-card {
    height: 100%;
}
.spa-secondary-actions,
.spa-primary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
    height: 60px;
    min-height: 60px;
    border-top: 1px solid var(--spa-border);
}
.spa-secondary-actions {
    margin-top: auto;
}
.spa-secondary-actions > *,
.spa-primary-actions > * {
    width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    margin: 0 !important;
    align-self: stretch;
}
.spa-secondary-actions > * + *,
.spa-primary-actions > * + * {
    border-left: 1px solid var(--spa-border) !important;
}
.spa-text-action,
.spa-quick-view-btn,
.spa-add-to-cart,
.woocommerce .spa-add-to-cart.button,
.spa-cart-placeholder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
    line-height: 1.15 !important;
    text-align: center !important;
    white-space: normal;
}
.spa-cart-placeholder {
    background: #fff;
}
.spa-cart-icon,
.spa-action-icon {
    flex: 0 0 auto;
}

@media (max-width: 767px) {
    .spa-secondary-actions,
    .spa-primary-actions,
    .spa-secondary-actions > *,
    .spa-primary-actions > *,
    .spa-text-action,
    .spa-quick-view-btn,
    .spa-add-to-cart,
    .woocommerce .spa-add-to-cart.button,
    .spa-cart-placeholder {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
    }
}
