/* ===============================
   SWIPER CORE
   =============================== */
.my-product-slider {
    width: 100%;
    overflow: hidden;
}
.my-product-slider .swiper-wrapper {
    display: flex;
}
.my-product-slider .swiper-slide {
    flex-shrink: 0;
}

/* ===============================
   PRODUCT CARD (BASE & RESPONSIVE)
   =============================== */
.my-product-slider .product-card {
    /* UPDATE 4 & 5: Global & Responsive Variables */
    background-color: var(--cws-card-bg, #ffffff);
    border-radius: var(--cws-card-radius, 16px);
    box-shadow: var(--cws-card-shadow, 0 6px 20px rgba(0,0,0,0.08));
    
    /* UPDATE 5: Responsive Padding & Height */
    padding: var(--cws-d-card-pad, 16px);
    min-height: var(--cws-d-min-h, 0px);
    
    text-align: var(--cws-d-align, center);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
}

/* Tablet Responsive Card */
@media (max-width: 1023px) {
    .my-product-slider .product-card {
        padding: var(--cws-t-card-pad, 16px);
        min-height: var(--cws-t-min-h, 0px);
        text-align: var(--cws-t-align, center);
    }
}

/* Mobile Responsive Card */
@media (max-width: 767px) {
    .my-product-slider .product-card {
        padding: var(--cws-m-card-pad, 12px);
        min-height: var(--cws-m-min-h, 0px);
        text-align: var(--cws-m-align, center);
    }
}

.my-product-slider .product-card a {
    text-decoration: none;
    color: inherit;
}

/* ===============================
   UPDATE 6: IMAGE STYLING & HOVER
   =============================== */
.my-product-slider .product-image {
    position: relative; /* Required for absolute badge positioning */
    display: block;
    overflow: hidden; /* Contains badge if image radius clips it */
    border-radius: var(--cws-img-radius, 8px);
}

.my-product-slider .product-image img {
    border-radius: var(--cws-img-radius, 8px);
    width: 100%;
    height: auto;
    display: block;
    /* UPDATE 6: Aspect Ratio */
    aspect-ratio: var(--cws-img-ratio, auto);
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease, opacity 0.3s ease;
}

/* UPDATE 6: Hover Effects */
.my-product-slider .product-image:hover img {
    /* Zoom Effect */
    --cws-hover-effect: var(--cws-hover-effect, none);
}
.my-product-slider[style*="--cws-hover-effect:zoom"] .product-image:hover img {
    transform: scale(1.05);
}
.my-product-slider[style*="--cws-hover-effect:grayscale"] .product-image:hover img {
    filter: grayscale(100%);
}
.my-product-slider[style*="--cws-hover-effect:opacity"] .product-image:hover img {
    opacity: 0.8;
}

/* UPDATE 6: Visibility Classes */
.my-product-slider.cws-hide-image .product-image {
    display: none;
}
.my-product-slider.cws-hide-price .product-price {
    display: none;
}
.my-product-slider.cws-hide-button .product-cart {
    display: none;
}

/* ===============================
   UPDATE 8: BADGE STYLES
   =============================== */
.my-product-slider .cws-badge {
    position: absolute;
    z-index: 10;
    background-color: var(--cws-badge-bg, #000000);
    color: var(--cws-badge-color, #ffffff);
    font-size: var(--cws-badge-size, 12px);
    font-weight: bold;
    padding: 4px 10px;
    line-height: 1.2;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    pointer-events: none; /* Let clicks pass through to image */
}

/* Badge Shapes */
.my-product-slider .badge-shape-pill {
    border-radius: 50px;
}
.my-product-slider .badge-shape-square {
    border-radius: 0;
}
.my-product-slider .badge-shape-circle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Reset padding for circle to keep it round */
    text-align: center;
}
/* Ribbon Shape (Simple Tag) */
.my-product-slider .badge-shape-ribbon {
    border-radius: 4px;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    padding-bottom: 12px; /* Extra bottom padding for the point */
}

/* Badge Positions */
.my-product-slider .badge-pos-top-left {
    top: 10px;
    left: 10px;
}
.my-product-slider .badge-pos-top-right {
    top: 10px;
    right: 10px;
}
.my-product-slider .badge-pos-bottom-left {
    bottom: 10px;
    left: 10px;
}
.my-product-slider .badge-pos-bottom-right {
    bottom: 10px;
    right: 10px;
}

/* ===============================
   TYPOGRAPHY (BASE & RESPONSIVE)
   =============================== */
.my-product-slider .product-title {
    color: var(--cws-title-color, #000000);
    font-size: var(--cws-d-title-size, 16px);
    line-height: var(--cws-d-title-lh, 1.4);
}

.my-product-slider .product-price {
    color: var(--cws-price-color, #000000);
    font-size: var(--cws-d-price-size, 16px);
    line-height: var(--cws-d-price-lh, 1.4);
}

/* Tablet Typography */
@media (max-width: 1023px) {
    .my-product-slider .product-title {
        font-size: var(--cws-t-title-size, 16px);
        line-height: var(--cws-t-title-lh, 1.4);
    }
    .my-product-slider .product-price {
        font-size: var(--cws-t-price-size, 16px);
        line-height: var(--cws-t-price-lh, 1.4);
    }
}

/* Mobile Typography */
@media (max-width: 767px) {
    .my-product-slider .product-title {
        font-size: var(--cws-m-title-size, 16px);
        line-height: var(--cws-m-title-lh, 1.2);
    }
    .my-product-slider .product-price {
        font-size: var(--cws-m-price-size, 16px);
        line-height: var(--cws-m-price-lh, 1.2);
    }
}

/* ===============================
   UPDATE 10: SALE PRICE STYLING
   =============================== */
/* Regular Price (Crossed out) */
.my-product-slider .product-price del {
    text-decoration: line-through;
    opacity: 0.6; /* Slightly fade the old price */
    margin-right: 8px; /* Add space between old and new price */
    display: inline-block; /* Ensures proper alignment */
}

/* Sale Price (Active) */
.my-product-slider .product-price ins {
    text-decoration: none;
    font-weight: bold;
    background: none; /* Remove default WooCommerce underline background */
    color: inherit; /* Use the main price color defined in variables */
}

/* ===============================
   BUTTONS (BASE, RESPONSIVE & UPDATE 9 AJAX)
   =============================== */
.my-product-slider .product-cart .button {
    background-color: var(--cws-btn-bg, #000000);
    color: var(--cws-btn-text, #ffffff);
    border-radius: var(--cws-btn-radius, 8px);
    
    /* UPDATE 5: Responsive Padding */
    padding: var(--cws-d-btn-pad, 10px);
    
    display: inline-flex; /* Flex for centering spinner/text */
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    transition: background-color 0.3s ease, opacity 0.3s ease;
}

/* Tablet Button */
@media (max-width: 1023px) {
    .my-product-slider .product-cart .button {
        padding: var(--cws-t-btn-pad, 10px);
    }
}

/* Mobile Button */
@media (max-width: 767px) {
    .my-product-slider .product-cart .button {
        padding: var(--cws-m-btn-pad, 12px);
    }
}

/* Button Hover */
.my-product-slider .product-cart .button:hover {
    background-color: var(--cws-btn-hover, #333333);
}

/* --- UPDATE 9: AJAX STATES --- */

/* Loading State */
.my-product-slider .cws-btn-loading .btn-text {
    opacity: 0.7;
}
.my-product-slider .cws-btn-loading .btn-loader {
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Added to Cart State */
.my-product-slider .cws-btn-added {
    background-color: var(--cws-btn-hover, #333333); /* Use hover color to indicate success */
    pointer-events: none; /* Prevent double clicks */
}

/* ===============================
   ARROWS VISIBILITY & COLOR
   =============================== */
.my-product-slider .swiper-button-prev,
.my-product-slider .swiper-button-next {
    display: none;
    color: var(--cws-nav-color, #000000);
}

@media (min-width: 1024px) {
    .my-product-slider.nav-show-desktop .swiper-button-prev,
    .my-product-slider.nav-show-desktop .swiper-button-next {
        display: flex;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .my-product-slider.nav-show-tablet .swiper-button-prev,
    .my-product-slider.nav-show-tablet .swiper-button-next {
        display: flex;
    }
}

@media (max-width: 767px) {
    .my-product-slider.nav-show-mobile .swiper-button-prev,
    .my-product-slider.nav-show-mobile .swiper-button-next {
        display: flex;
    }
}

/* ===============================
   PAGINATION DOTS VISIBILITY & COLOR (UPDATED)
   =============================== */
.my-product-slider .swiper-pagination {
    display: none;
    /* UPDATE 5: Responsive Margin/Padding */
    margin: var(--cws-d-pag-mar, 0px);
    padding: var(--cws-d-pag-pad, 0px);
    
    /* UPDATE 6: FIX - Push pagination below cards */
    margin-top: 20px; 
    width: 100%;
    position: relative; /* Ensure it's in flow */
}

.my-product-slider .swiper-pagination-bullet {
    background-color: var(--cws-nav-color, #000000);
    opacity: 0.3;
}
.my-product-slider .swiper-pagination-bullet-active {
    opacity: 1;
}

/* Tablet Pagination */
@media (max-width: 1023px) {
    .my-product-slider .swiper-pagination {
        margin: var(--cws-t-pag-mar, 0px);
        padding: var(--cws-t-pag-pad, 0px);
        margin-top: 20px; /* Keep spacing on tablet */
    }
}

/* Mobile Pagination */
@media (max-width: 767px) {
    .my-product-slider .swiper-pagination {
        margin: var(--cws-m-pag-mar, 0px);
        padding: var(--cws-m-pag-pad, 0px);
        margin-top: 15px; /* Slightly less on mobile */
    }
}

/* Visibility Toggles */
@media (min-width: 1024px) {
    .my-product-slider.pag-show-desktop .swiper-pagination {
        display: block;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .my-product-slider.pag-show-tablet .swiper-pagination {
        display: block;
    }
}

@media (max-width: 767px) {
    .my-product-slider.pag-show-mobile .swiper-pagination {
        display: block;
    }
}

/* ===============================
   CARD PEEK SPACING (FRONTEND)
   =============================== */
@media (max-width: 767px) {
    .my-product-slider {
        padding-left: 12px;
    }
}

/* =====================================================
   🟢 GUTENBERG EDITOR ONLY FIXES
   ===================================================== */

/* Force proper width so Swiper can show multiple slides */
.block-editor-page .my-product-slider {
    max-width: 100%;
    padding-left: 12px;
    transition: max-width 0.3s ease; /* Smooth resize animation */
}

/* UPDATE 7: Editor Preview Modes */
.block-editor-page .editor-mode-tablet {
    max-width: 768px;
    margin: 0 auto;
    border: 2px dashed #e0e0e0; /* Visual cue for tablet */
    padding: 10px;
    box-sizing: border-box;
}

.block-editor-page .editor-mode-mobile {
    max-width: 375px;
    margin: 0 auto;
    border: 2px dashed #e0e0e0; /* Visual cue for mobile */
    padding: 10px;
    box-sizing: border-box;
}

/* Force slides to behave like 3.5 cards visually */
.block-editor-page .my-product-slider .swiper-slide {
    width: 28% !important; /* ≈ 3.5 slides */
}

/* Disable clicks inside editor (prevent navigation) */
.block-editor-page .my-product-slider a,
.block-editor-page .my-product-slider button {
    pointer-events: none;
    cursor: default;
}