/**
 * WooCommerce Dynamic Product Showcase - Frontend Styles
 * Pixel-perfect match for the reference design
 */

/* ==========================================================================
   Base Container & Scoped Typography
   ========================================================================== */
.wps-showcase-container {
    --wps-primary: #C5161D;
    --wps-primary-hover: #A31217;
    --wps-primary-light: rgba(197, 22, 29, 0.08);
    --wps-text-main: #111111;
    --wps-text-sub: #777777;
    --wps-img-bg: #F5F5F7;
    --wps-card-radius: 12px;
    --wps-btn-radius: 4px;
    --wps-gap: 24px;
    --wps-cols-desktop: 4;
    --wps-cols-tablet: 2;
    --wps-cols-mobile: 1;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--wps-text-main);
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 16px;
    box-sizing: border-box;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.wps-showcase-container *,
.wps-showcase-container *::before,
.wps-showcase-container *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Section Header
   ========================================================================== */
.wps-showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    gap: 16px;
}

.wps-header-left {
    display: flex;
    flex-direction: column;
}

.wps-showcase-subtitle {
    font-size: 11px;
    font-weight: 700;
    color: var(--wps-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
    line-height: 1.2;
}

.wps-showcase-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--wps-text-main);
    letter-spacing: -0.5px;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.15;
}

.wps-header-right {
    flex-shrink: 0;
}

.wps-showcase-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #555555;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.wps-showcase-view-all:hover {
    color: var(--wps-primary);
}

.wps-showcase-view-all .wps-arrow-icon {
    transition: transform 0.2s ease;
}

.wps-showcase-view-all:hover .wps-arrow-icon {
    transform: translateX(4px);
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */
.wps-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--wps-cols-desktop, 4), minmax(0, 1fr));
    gap: 36px var(--wps-gap);
}

@media (max-width: 1024px) {
    .wps-grid-wrapper {
        grid-template-columns: repeat(var(--wps-cols-tablet, 2), minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .wps-grid-wrapper {
        grid-template-columns: repeat(var(--wps-cols-mobile, 1), minmax(0, 1fr));
        gap: 28px 16px;
    }
}

/* ==========================================================================
   Product Card
   ========================================================================== */
.wps-product-card {
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 6px;
}

/* Highlighted/active card effect (like card 2 in reference) */
.wps-product-card.wps-card-featured,
.wps-product-card:hover {
    box-shadow: 0 0 0 1.5px rgba(197, 22, 29, 0.35);
    border-radius: 14px;
}

/* Image Container */
.wps-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--wps-img-bg);
    border-radius: var(--wps-card-radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wps-image-slider {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.wps-image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wps-image-slide.wps-active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

.wps-image-link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
    text-decoration: none;
}

.wps-product-thumbnail {
    max-width: 88%;
    max-height: 88%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.35s cubic-bezier(0.2, 0, 0.2, 1);
    user-select: none;
    -webkit-user-drag: none;
}

.wps-product-card:hover .wps-product-thumbnail {
    transform: scale(1.04);
}

/* In-Card Gallery Navigation Arrows (Match reference image red circles) */
.wps-gallery-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
    z-index: 10;
}

.wps-gallery-btn {
    pointer-events: auto;
    width: 26px;
    height: 26px;
    background-color: var(--wps-primary);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, transform 0.15s ease;
    padding: 0;
}

.wps-gallery-btn:hover {
    background-color: var(--wps-primary-hover);
    transform: scale(1.12);
}

.wps-gallery-btn:active {
    transform: scale(0.95);
}

.wps-gallery-btn svg {
    display: block;
}

/* ==========================================================================
   Card Details & Typography
   ========================================================================== */
.wps-card-details {
    display: flex;
    flex-direction: column;
    padding: 12px 2px 2px 2px;
    flex-grow: 1;
}

.wps-product-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wps-product-title a {
    color: var(--wps-text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.wps-product-title a:hover {
    color: var(--wps-primary);
}

.wps-product-subtitle {
    font-size: 11.5px;
    color: var(--wps-text-sub);
    font-weight: 400;
    margin-bottom: 6px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wps-product-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--wps-text-main);
    margin-bottom: 12px;
    line-height: 1.2;
}

.wps-product-price del {
    color: #999999;
    font-weight: 400;
    font-size: 13px;
    margin-right: 6px;
}

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

/* ==========================================================================
   Add to Cart Button
   ========================================================================== */
.wps-card-actions {
    margin-top: auto;
}

.wps-btn-add-to-cart {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--wps-primary) !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.6px !important;
    text-transform: uppercase !important;
    text-align: center;
    text-decoration: none !important;
    padding: 10px 16px !important;
    border-radius: var(--wps-btn-radius) !important;
    border: none !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    line-height: 1.4 !important;
}

.wps-btn-add-to-cart:hover {
    background-color: var(--wps-primary-hover) !important;
    box-shadow: 0 4px 10px rgba(197, 22, 29, 0.28);
}

.wps-btn-add-to-cart:active {
    transform: scale(0.98);
}

.wps-btn-add-to-cart.wps-btn-out-of-stock {
    background-color: #CCCCCC !important;
    color: #666666 !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* Button Loading State */
.wps-btn-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wps-spin 0.7s infinite linear;
    margin-left: 6px;
}

.wps-btn-success {
    display: none;
    margin-left: 6px;
    font-size: 13px;
}

.wps-btn-add-to-cart.loading .wps-btn-spinner {
    display: inline-block;
}

.wps-btn-add-to-cart.added .wps-btn-success {
    display: inline-block;
}

.wps-btn-add-to-cart.added {
    background-color: #2E7D32 !important; /* Green feedback */
}

@keyframes wps-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Carousel Mode
   ========================================================================== */
.wps-layout-carousel .wps-carousel-outer {
    position: relative;
    width: 100%;
}

.wps-carousel-viewport {
    overflow: hidden;
    width: 100%;
}

.wps-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.wps-carousel-slide {
    flex-shrink: 0;
    box-sizing: border-box;
    padding-right: var(--wps-gap);
    width: calc(100% / var(--wps-cols-desktop, 4));
}

@media (max-width: 1024px) {
    .wps-carousel-slide {
        width: calc(100% / var(--wps-cols-tablet, 2));
    }
}

@media (max-width: 640px) {
    .wps-carousel-slide {
        width: calc(100% / var(--wps-cols-mobile, 1));
        padding-right: 16px;
    }
}

/* Carousel Navigation Arrows */
.wps-carousel-nav-btn {
    position: absolute;
    top: 42%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    background-color: #FFFFFF;
    color: var(--wps-text-main);
    border: 1px solid #E5E5E5;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
    padding: 0;
}

.wps-carousel-nav-btn:hover {
    background-color: var(--wps-primary);
    color: #FFFFFF;
    border-color: var(--wps-primary);
    box-shadow: 0 6px 16px rgba(197, 22, 29, 0.3);
}

.wps-carousel-prev {
    left: -18px;
}

.wps-carousel-next {
    right: -18px;
}

@media (max-width: 768px) {
    .wps-carousel-prev {
        left: -8px;
    }
    .wps-carousel-next {
        right: -8px;
    }
}

/* Carousel Dots */
.wps-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.wps-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #D1D5DB;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s, transform 0.2s;
}

.wps-carousel-dot.active {
    background-color: var(--wps-primary);
    transform: scale(1.3);
}
