/* =========================================================
   WooCommerce Product Showcase Pro — Frontend Styles v3
   FIXED: swatches no longer escape card / bleed into footer
   ========================================================= */

/* ── Universal Reset ─────────────────────────────────────── */
.wps-wrapper, .wps-wrapper * { box-sizing: border-box; }
.wps-wrapper { display: block; width: 100%; float: none; clear: both; }

/* ── Grid ────────────────────────────────────────────────── */
.wps-grid-wrapper {
    display: grid !important;
    grid-template-columns: repeat(var(--wps-cols-d, 4), 1fr);
    gap: var(--wps-gap, 24px);
    align-items: start;
    list-style: none;
    margin: 0;
    padding: 0;
}
.wps-grid-wrapper > .wps-card {
    min-width: 0;
    width: 100%;
    float: none;
    clear: none;
    margin: 0;
}
@media (max-width: 1279px) { .wps-grid-wrapper { grid-template-columns: repeat(var(--wps-cols-l, 3), 1fr); } }
@media (max-width: 1024px) { .wps-grid-wrapper { grid-template-columns: repeat(var(--wps-cols-t, 2), 1fr); } }
@media (max-width: 640px)  { .wps-grid-wrapper { grid-template-columns: repeat(var(--wps-cols-m, 1), 1fr); gap: calc(var(--wps-gap, 24px) * 0.7); } }

/* ── Card ────────────────────────────────────────────────── */
.wps-card {
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease, box-shadow .3s ease;
    border-radius: 8px;
}
.wps-card.wps-shadow { box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.wps-card.wps-hover-lift:hover { transform: translateY(-5px); box-shadow: 0 10px 32px rgba(0,0,0,.14) !important; }

/* ── Image Wrap ──────────────────────────────────────────── */
/*
   THE CORE FIX:
   Old code used padding-top::before trick to set image height.
   Themes often override ::before pseudo-elements causing the image
   wrap to COLLAPSE to 0px height. When it's 0px, the overlay is
   also 0px, and swatches overflow downward out of the card into
   the footer. We now use aspect-ratio which cannot be collapsed
   by theme CSS resets.
*/
.wps-card-image-wrap {
    position: relative;
    overflow: hidden;
    background: #f7f7f7;
    border-radius: 8px;
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
}
/* Kill the old padding-top trick completely */
.wps-card-image-wrap::before { display: none !important; content: none !important; }

.wps-product-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Image Transition Types ──────────────────────────────── */
.wps-img-trans-fade .wps-product-img { transition: transform .4s ease; }
.wps-img-trans-fade .wps-card:hover .wps-product-img { transform: scale(1.04); }
.wps-img-trans-zoom .wps-product-img { transition: transform .45s ease; transform-origin: center center; }
.wps-img-trans-zoom .wps-card:hover .wps-product-img { transform: scale(1.1); }
.wps-product-img.wps-img-zoom-out { transform: scale(0.92) !important; opacity: .6; transition: transform .15s ease, opacity .15s ease !important; }
.wps-product-img.wps-img-zoom-in  { transform: scale(1.06) !important; opacity: 1;  transition: transform .2s ease, opacity .2s ease !important; }
.wps-img-trans-slide .wps-product-img { position: absolute; transition: transform .4s ease; }
.wps-img-trans-slide .wps-card:hover .wps-product-img { transform: scale(1.04); }
.wps-img-trans-none .wps-product-img { transition: none; }

/* ── Badges ──────────────────────────────────────────────── */
.wps-badge {
    position: absolute; top: 10px; left: 10px; z-index: 12;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; padding: 3px 8px; border-radius: 4px; pointer-events: none;
}
.wps-badge-sale { background: #e44d26; color: #fff; }
.wps-badge-oos  { background: #999;    color: #fff; }

/* ── Overlay ─────────────────────────────────────────────── */
/*
   CONTAINED: overlay is inside .wps-card-image-wrap which has
   overflow:hidden + a real height from aspect-ratio.
   Swatches CANNOT escape past the bottom edge of the image.
*/
.wps-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 12px;
    z-index: 8;
    pointer-events: none;
    overflow: hidden;
}
.wps-overlay-hover { opacity: 0; transition: opacity .3s ease; }
.wps-card:hover .wps-overlay-hover { opacity: 1; pointer-events: all; }
.wps-overlay-hover .wps-attr-swatches,
.wps-overlay-hover .wps-no-attr-cart,
.wps-overlay-hover .wps-quick-view-btn { pointer-events: all; }
.wps-template-static .wps-overlay { opacity: 1; pointer-events: all; }

/* ── Attribute Swatches ──────────────────────────────────── */
.wps-attr-swatches {
    display: flex; flex-direction: row; flex-wrap: wrap;
    align-content: flex-end; align-items: center; justify-content: center;
    gap: 5px; width: 100%; max-height: 72px; overflow: hidden;
    padding: 0 4px 2px; flex-shrink: 0;
}
.wps-swatch {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; padding: 4px 9px; font-size: 11px; font-weight: 700;
    border-radius: 4px; cursor: pointer; border: 2px solid transparent;
    transition: background .15s, color .15s, transform .12s, border-color .15s;
    user-select: none; line-height: 1.2; white-space: nowrap;
}
.wps-swatch:hover { transform: scale(1.08); }
.wps-swatch.wps-swatch-selected { border-color: rgba(0,0,0,.3); }
.wps-swatch.wps-swatch-oos { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.wps-swatch.wps-swatch-oos:hover { transform: none; }
.wps-swatch.wps-swatch-adding { animation: wps-pulse .5s ease; }
@keyframes wps-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* ── Per-Device Attribute Visibility ────────────────────── */
.wps-wrapper[data-attr-desktop="off"] .wps-attr-swatches { display: none; }
.wps-wrapper[data-attr-desktop="hover"] .wps-overlay:not(.wps-overlay-hover):not(:hover) .wps-attr-swatches { display: none; }
@media (max-width: 1024px) { .wps-wrapper[data-attr-tablet="off"] .wps-attr-swatches { display: none; } }
@media (max-width: 640px) {
    .wps-wrapper[data-attr-mobile="off"]    .wps-attr-swatches { display: none; }
    .wps-wrapper[data-attr-mobile="static"] .wps-attr-swatches { display: flex !important; }
    .wps-wrapper[data-attr-mobile="static"] .wps-overlay { opacity: 1 !important; pointer-events: all !important; }
}

/* ── No-Attribute Cart Button ────────────────────────────── */
.wps-add-cart-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; background: #222; color: #fff; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: opacity .2s, transform .15s; white-space: nowrap;
}
.wps-add-cart-btn:hover { opacity: .82; }
.wps-cart-icon { border-radius: 50%; padding: 0; }
.wps-cart-icon svg { display: block; flex-shrink: 0; }
.wps-btn-hover-mode { opacity: 0; transform: translateY(6px); pointer-events: none; transition: all .25s; }
.wps-card:hover .wps-btn-hover-mode { opacity: 1; transform: translateY(0); pointer-events: all; }

/* ── Quick View Button ───────────────────────────────────── */
.wps-quick-view-btn {
    position: absolute; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: none; cursor: pointer; z-index: 12;
    transition: transform .2s, box-shadow .2s, opacity .25s; pointer-events: all;
}
.wps-quick-view-btn:hover { transform: scale(1.12); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.wps-qv-pos-top-right    { top: 10px; right: 10px; }
.wps-qv-pos-top-left     { top: 10px; left: 10px; }
.wps-qv-pos-bottom-right { bottom: 10px; right: 10px; }
.wps-qv-pos-center       { top: 50%; left: 50%; transform: translate(-50%,-50%); }
.wps-qv-pos-center:hover { transform: translate(-50%,-50%) scale(1.12); }
.wps-qv-mode-hover .wps-quick-view-btn { opacity: 0; transition: opacity .25s ease; }
.wps-qv-mode-hover .wps-card:hover .wps-quick-view-btn,
.wps-card:hover .wps-quick-view-btn { opacity: 1; }
.wps-qv-mode-static .wps-quick-view-btn { opacity: 1 !important; }
.wps-qv-mode-off    .wps-quick-view-btn { display: none !important; }

/* ── Card Info ───────────────────────────────────────────── */
.wps-card-info { padding-top: 10px; flex: 1; }
.wps-cat { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; margin-bottom: 4px; transition: color .2s; }
.wps-product-title { margin: 0 0 5px; line-height: 1.35; }
.wps-product-title a { text-decoration: none; transition: color .2s; }
.wps-product-title a:hover { text-decoration: underline; }
.wps-stars { display: flex; gap: 2px; font-size: 13px; margin-bottom: 5px; }
.wps-star-empty { opacity: .25; }
.wps-star-half  { opacity: .6; }
.wps-short-desc { font-size: 12px; color: #666; margin: 4px 0; line-height: 1.55; }
.wps-price { font-weight: 700; margin: 6px 0; line-height: 1.3; }
.wps-price del { opacity: .5; font-size: .84em; }
.wps-price ins { text-decoration: none; }

/* ── Carousel ────────────────────────────────────────────── */
.wps-carousel-wrapper { position: relative; padding-bottom: 32px; }
.wps-swiper { overflow: hidden; }
.wps-swiper .swiper-slide { height: auto; }
.wps-nav-btn {
    position: absolute; top: 50%; transform: translateY(-55%); z-index: 20;
    border: none; border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.12); cursor: pointer;
    display: flex; align-items: center; justify-content: center; line-height: 1;
    transition: background .2s, color .2s, transform .2s, box-shadow .2s; flex-shrink: 0;
}
.wps-nav-btn:hover { transform: translateY(-55%) scale(1.1); box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.wps-btn-prev { left: -20px; }
.wps-btn-next { right: -20px; }
@media (max-width: 640px) { .wps-btn-prev { left: -6px; } .wps-btn-next { right: -6px; } }
.wps-pagination { text-align: center; margin-top: 14px; }
.wps-pagination .swiper-pagination-bullet { opacity: 1; transition: background .2s; }

/* ── Load More ───────────────────────────────────────────── */
.wps-load-more-wrap { text-align: center; margin-top: 32px; }
.wps-load-more-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 38px;
    font-size: 14px; font-weight: 700; letter-spacing: .03em; border: none; cursor: pointer;
    transition: opacity .2s, transform .2s;
}
.wps-load-more-btn:hover    { opacity: .88; transform: translateY(-1px); }
.wps-load-more-btn:disabled { opacity: .5; cursor: wait; transform: none; }

/* ── Toast ───────────────────────────────────────────────── */
.wps-toast {
    position: fixed; bottom: 28px; right: 28px; display: flex; align-items: center; gap: 10px;
    padding: 13px 22px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #fff;
    z-index: 9999999; box-shadow: 0 6px 24px rgba(0,0,0,.22); transform: translateX(120%);
    transition: transform .35s cubic-bezier(.34,1.56,.64,1); max-width: 340px;
}
.wps-toast.wps-toast-in  { transform: translateX(0); }
.wps-toast.wps-toast-out { transform: translateX(140%); transition: transform .3s ease; }
.wps-toast-success { background: #27ae60; }
.wps-toast-error   { background: #c0392b; }
.wps-toast-icon    { font-size: 18px; flex-shrink: 0; }
@media (max-width: 480px) { .wps-toast { bottom: 16px; right: 16px; left: 16px; max-width: none; } }

/* ── Quick View Modal ────────────────────────────────────── */
.wps-modal { position: fixed; inset: 0; z-index: 999998; display: flex; align-items: center; justify-content: center; padding: 16px; }
.wps-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); cursor: pointer; }
.wps-modal-content {
    position: relative; background: #fff; border-radius: 14px;
    max-width: 900px; width: 100%; max-height: 92vh; overflow-y: auto;
    z-index: 1; padding: 32px; animation: wps-modal-in .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes wps-modal-in { from { transform: scale(.9) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.wps-modal-close {
    position: absolute; top: 14px; right: 16px; background: #f5f5f5; border: none;
    width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer;
    color: #666; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s;
}
.wps-modal-close:hover { background: #222; color: #fff; }
.wps-modal-loading { text-align: center; padding: 60px; color: #888; font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.wps-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #e0e0e0; border-top-color: #5c6fbe; animation: wps-spin .7s linear infinite; }
@keyframes wps-spin { to { transform: rotate(360deg); } }
.wps-qv-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 640px) { .wps-qv-inner { grid-template-columns: 1fr; gap: 20px; } .wps-modal-content { padding: 20px; } }
.wps-qv-gallery { display: flex; flex-direction: column; gap: 12px; }
.wps-qv-main-img-wrap { border-radius: 10px; overflow: hidden; background: #f7f7f7; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
#wps-qv-main-img { width: 100%; height: 100%; object-fit: contain; transition: opacity .2s; }
.wps-qv-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.wps-qv-thumb { width: 64px; height: 64px; border-radius: 7px; object-fit: cover; cursor: pointer; border: 2px solid transparent; transition: border-color .2s; }
.wps-qv-thumb.active, .wps-qv-thumb:hover { border-color: #5c6fbe; }
.wps-qv-title      { font-size: 22px; font-weight: 700; margin: 0 0 10px; line-height: 1.3; }
.wps-qv-meta       { font-size: 12px; color: #999; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.wps-qv-meta span  { display: flex; align-items: center; gap: 4px; }
.wps-qv-price      { font-size: 22px; font-weight: 800; color: #e44d26; margin-bottom: 6px; }
.wps-qv-rating     { margin-bottom: 12px; }
.wps-qv-short-desc { font-size: 14px; color: #555; line-height: 1.65; margin-bottom: 18px; }
.wps-qv-attributes { margin-bottom: 18px; }
.wps-qv-attr-row   { margin-bottom: 14px; }
.wps-qv-attr-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #666; margin-bottom: 8px; }
.wps-qv-selected-val { font-weight: 600; text-transform: none; letter-spacing: 0; color: #333; font-size: 12px; }
.wps-qv-attr-options { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; max-height: calc(2 * 36px + 6px); overflow: hidden; padding-bottom: 2px; }
.wps-qv-swatch { flex-shrink: 0; padding: 6px 16px; border: 2px solid #e0e0e0; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .2s; }
.wps-qv-swatch:hover   { border-color: #5c6fbe; color: #5c6fbe; }
.wps-qv-swatch.selected { background: #222; color: #fff; border-color: #222; font-weight: 700; }
.wps-qv-variation-notice { font-size: 12px; color: #c0392b; margin-top: 8px; min-height: 18px; font-weight: 500; }
.wps-qv-cart-row { display: flex; gap: 10px; align-items: stretch; margin-bottom: 18px; flex-wrap: wrap; }
.wps-qv-qty-wrap { display: flex; align-items: center; border: 2px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.wps-qty-btn { width: 38px; height: 44px; border: none; background: #f5f5f5; font-size: 18px; font-weight: 700; cursor: pointer; transition: background .15s; }
.wps-qty-btn:hover { background: #e8e8e8; }
.wps-qty-input { width: 52px; height: 44px; border: none; border-left: 2px solid #e0e0e0; border-right: 2px solid #e0e0e0; text-align: center; font-size: 14px; font-weight: 700; }
.wps-qty-input:focus { outline: none; }
.wps-qv-add-cart-btn { flex: 1; min-width: 130px; padding: 10px 24px; background: #222; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .2s, opacity .2s; }
.wps-qv-add-cart-btn:hover:not(:disabled) { background: #444; }
.wps-qv-add-cart-btn.wps-qv-btn-disabled, .wps-qv-add-cart-btn:disabled { background: #ccc; cursor: not-allowed; opacity: .75; }
.wps-qv-add-cart-btn.wps-qv-btn-ready { background: #27ae60; }
.wps-qv-view-full { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #888; text-decoration: underline; }
.wps-out-of-stock { display: inline-block; padding: 8px 18px; background: #f5f5f5; color: #999; border-radius: 8px; font-size: 13px; }

/* ── No Products ─────────────────────────────────────────── */
.wps-no-products { text-align: center; color: #aaa; padding: 40px; font-size: 15px; }

/* ── Mobile card info ────────────────────────────────────── */
@media (max-width: 480px) {
    .wps-card-info { padding-top: 8px; }
    .wps-product-title a { font-size: 13px !important; }
    .wps-price { font-size: 13px !important; }
}
