/**
 * Pre-Order Display Styles
 * 
 * Styles for badges, availability text, and countdown timers
 * 
 * @package FME_POBO
 * @since 1.0.0
 */

/* ============================================
   Pre-Order Badge Styles
   ============================================ */

.apo-preorder-badge {
	display: inline-block;
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #ffffff;
	line-height: 1.2;
	z-index: 10;
	position: relative;
}

/* Badge Style: Text Pill - Base styles (detailed styles at bottom of file) */
.apo-badge-text_pill {
	border-radius: 20px;
	background-color: var(--badge-color, #e91e63);
	background-image: linear-gradient(135deg, 
		rgba(255, 255, 255, 0.15) 0%, 
		transparent 50%,
		rgba(0, 0, 0, 0.1) 100%);
	color: var(--badge-text-color, #ffffff);
}

/* Badge Style: Sash - Base styles (detailed styles at bottom of file) */
.apo-badge-sash {
	position: absolute;
	top: 15px;
	right: -35px;
	padding: 10px 50px;
	transform: rotate(45deg);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
	z-index: 100;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1.2px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	overflow: visible;
	white-space: nowrap;
	line-height: 1.2;
	color: var(--badge-text-color, #ffffff);
	/* Use CSS custom property for dynamic color */
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15) 0%, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
	background-color: var(--badge-color, #e91e63);
	background-blend-mode: overlay;
}



/* ============================================
   CORNER RIBBON - CLEAN VERSION
   ::before  = main triangle
   ::after   = fold-shadow triangle (3D depth)
   inner span.apo-badge-corner_ribbon-text = badge label
   ============================================ */

/* Outer container - zero-size anchor at top-left of image */
.apo-badge-corner_ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 100;
    overflow: visible;
    pointer-events: none;
    font-size: 0;   /* hide any stray text nodes */
    line-height: 0;
}

/* Main coloured triangle */
.apo-badge-corner_ribbon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 52px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 80px 80px 0 0;
    border-color: var(--ribbon-color, #ff5722) transparent transparent transparent;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Fold-shadow triangle (darker corner for 3-D depth) */
.apo-badge-corner_ribbon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 0;
    /* border-color: var(--ribbon-shadow, rgba(0,0,0,0.25)) transparent transparent transparent; */
    z-index: 2;
}

/* Text label - rotated to lie along the hypotenuse */
/* For an 80x80 triangle: hypotenuse midpoint ≈ (40,40).
   Center of a 70px-wide element at left:-5px is (-5+35=30 ≈ 40) — close enough */
.apo-badge-corner_ribbon-text {
    position: absolute;
    top: 26px;
    left: -6px;
    width: 70px;
    transform: rotate(316deg);
    transform-origin: center center;
    text-align: center;
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 3;
    line-height: 1;
    /* color is set via inline style from PHP */
}

/* ============================================
   SHOP / ARCHIVE PAGE — Corner Ribbon
   Full override of base rules (which are tuned for single product).
   70×70 triangle at top-left of the product thumbnail.
   ============================================ */

.woocommerce ul.products li.product .apo-badge-corner_ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 100;
    overflow: visible;
    pointer-events: none;
    font-size: 0;
    line-height: 0;
}

/* Triangle — reset left: 52px from base, use left: 0 */
.woocommerce ul.products li.product .apo-badge-corner_ribbon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;          /* override base left: 52px */
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 70px 70px 0 0;
    border-color: var(--ribbon-color, #ff5722) transparent transparent transparent;
    z-index: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
}

/* Fold shadow — reset */
.woocommerce ul.products li.product .apo-badge-corner_ribbon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 7px 0 0;
    border-color: var(--ribbon-shadow, rgba(0,0,0,0.2)) transparent transparent transparent;
    z-index: 2;
}

/* Text on shop ribbon — 70×70 triangle.
   Hypotenuse midpoint ≈ (35, 35). Text rotated -45deg (316deg) to match diagonal.
   Center of a 60px-wide element at left: 5px → center at 5+30 = 35 ✓ */
.woocommerce ul.products li.product .apo-badge-corner_ribbon-text {
    position: absolute;
    top: 18px;
    left: 5px;        /* override base left: -6px */
    width: 60px;
    transform: rotate(316deg);   /* same direction as base, tuned for shop */
    transform-origin: center center;
    text-align: center;
    font-size: 7px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 3;
    line-height: 1;
}

/* ============================================
   SINGLE PRODUCT PAGE ADJUSTMENTS
   ============================================ */

/* Gallery container - ensure proper positioning */
.single-product .woocommerce-product-gallery,
.single-product div.product div.images {
    position: relative !important;
    overflow: visible !important;
}

/* Gallery images - ensure they can be positioning contexts for badges 
   BUT do not set overflow visible on gallery wrapper or flex-viewport - it breaks the slider */
.single-product .woocommerce-product-gallery__image {
    position: relative !important;
}

/* Remove any border-radius that might clip badges */
.single-product .woocommerce-product-gallery__image img {
    border-radius: 0 !important;
}

/* DO NOT set overflow visible on flex-viewport - it breaks the slider!
   Instead, position badges outside the slider container */
/* .single-product .woocommerce-product-gallery__wrapper,
.single-product .flex-viewport {
    overflow: visible !important;
} */

/* Badge wrapper for single product - extends beyond gallery to prevent clipping
   Must be a direct child of .woocommerce-product-gallery (not inside slider) */
.single-product .apo-badge-wrapper {
    position: absolute !important;
    top: -50px !important; /* Extend above gallery for rotated badges */
    left: -50px !important; /* Extend to the left */
    right: -50px !important; /* Extend to the right */
    bottom: -50px !important; /* Extend below gallery */
    width: auto !important;
    height: auto !important;
    z-index: 999 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    overflow: visible !important;
}

/* Ensure gallery is the positioning context for badge wrapper */
.single-product .woocommerce-product-gallery:has(.apo-badge-wrapper),
.single-product div.images:has(.apo-badge-wrapper) {
    position: relative !important;
    overflow: visible !important;
}

/* Ensure all parent containers allow overflow */
body.single-product,
body.single-product .site-main,
body.single-product .content-area,
body.single-product .product {
    overflow: visible !important;
}

/* Position badge absolutely on product gallery - BASE STYLES */
.single-product .apo-preorder-badge {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 100 !important;
    margin: 0 !important;
    pointer-events: auto;
}

/* ===== CORNER RIBBON - Single Product ===== */
.single-product .apo-badge-corner_ribbon {
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
}

/* Main triangle */
.single-product .apo-badge-corner_ribbon::before {
    border-width: 120px 120px 0 0;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
    transition: filter 0.3s ease;
}

/* Fold shadow */
.single-product .apo-badge-corner_ribbon::after {
    border-width: 14px 14px 0 0;
}

/* Text on single product ribbon — 120×120 triangle, midpoint ≈ (60,60).
   Center of a 110px-wide element at left:-5px is (-5+55=50 ≈ 60) */
.single-product .apo-badge-corner_ribbon-text {
    top: 46px;
    left: 53px;
    width: 110px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.5px;
    padding: 0;
    text-shadow:
        0 1px 3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hover effect */
.single-product .apo-badge-corner_ribbon:hover::before {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45));
}

/* ===== SASH BADGE - Single Product ===== */
/* Styles are defined in the unified section below to avoid duplication */

/* ===== TEXT PILL - Single Product ===== */
.single-product .apo-badge-text_pill {
    top: 32px !important;
    right: 74px !important;
    left: auto !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    border-radius: 25px !important;
    /* Use CSS custom property from Display settings */
    color: var(--badge-text-color, #ffffff) !important;
    background-color: var(--badge-color, #e91e63) !important;
    background-image: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%, 
        transparent 50%,
        rgba(0, 0, 0, 0.1) 100%) !important;
    /* Multiple shadows for depth */
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2) !important;
    /* Text shadow for better readability */
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2) !important;
    /* Smooth transitions */
    transition: all 0.3s ease !important;
    /* Ensure no clipping */
    overflow: visible !important;
    white-space: nowrap !important;
}

/* Add subtle shine effect */
.single-product .apo-badge-text_pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    border-radius: 25px 25px 0 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    pointer-events: none;
}

/* Hover effect for text pill */
.single-product .apo-badge-text_pill:hover {
    transform: translateY(-2px) !important;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 3px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2) !important;
}

/* ============================================
   ENSURE PROPER OVERFLOW
   ============================================ */

/* Make sure parent containers don't clip the ribbon/sash/badge 
   EXCEPT flex-viewport which needs overflow hidden for the slider to work */
.woocommerce ul.products li.product,
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
.woocommerce ul.products li.product .product-image,
.single-product .product-image-wrapper,
.single-product .woocommerce-product-gallery,
.single-product div.product div.images {
    position: relative !important;
    overflow: visible !important;
}

/* Gallery wrapper needs visible overflow for badges to show outside */
.single-product .woocommerce-product-gallery {
    overflow: visible !important;
}

/* ============================================
   RESPONSIVE — Badges
   Breakpoints: 1280 · 1024 · 768 · 480 · 360
   ============================================ */

/* ── Large Desktop (≤ 1280px) — keep sash proportional ─────── */
@media (max-width: 1280px) {
    .single-product .apo-badge-sash {
        padding: 11px clamp(40px, 7vw, 55px) !important;
    }
    .single-product .apo-badge-wrapper .apo-badge-sash {
        padding: 11px clamp(38px, 6.5vw, 50px) !important;
    }
}

/* ── Tablet (≤ 1024px) ──────────────────────────────────────── */
@media (max-width: 1024px) {
    /* Text pill — slightly smaller on tablets */
    .single-product .apo-badge-text_pill {
        top: 28px !important;
        right: 60px !important;
        padding: 8px 16px !important;
        font-size: 12px !important;
    }

    /* Corner ribbon — reduce triangle */
    .single-product .apo-badge-corner_ribbon::before {
        border-width: 100px 100px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon::after {
        border-width: 12px 12px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon-text {
        top: 38px !important;
        left: 40px !important;
        width: 90px !important;
        font-size: 9px !important;
    }

    /* Sash — tighten padding at tablet */
    .single-product .apo-badge-sash {
        padding: 10px clamp(32px, 6vw, 48px) !important;
        font-size: 10px !important;
    }
    .single-product .apo-badge-wrapper .apo-badge-sash {
        padding: 10px clamp(30px, 5.5vw, 46px) !important;
        font-size: 10px !important;
    }

    /* Countdown — single product */
    .single-product .apo-countdown-item {
        min-width: 52px;
        padding: 10px 8px 7px;
    }
    .single-product .apo-countdown-value {
        font-size: 22px;
    }
}

/* ── Mobile (≤ 768px) ──────────────────────────────────────── */
@media (max-width: 768px) {
    /* Corner ribbon — base (shop & single) */
    .apo-badge-corner_ribbon::before {
        border-width: 65px 65px 0 0;
    }
    .apo-badge-corner_ribbon::after {
        border-width: 6px 6px 0 0;
    }
    .apo-badge-corner_ribbon-text {
        top: 12px;
        left: 3px;
        font-size: 7px;
        letter-spacing: 0.8px;
        width: 55px;
    }

    /* Single product — text pill */
    .single-product .apo-badge-text_pill {
        top: 20px !important;
        right: 20px !important;
        padding: 7px 14px !important;
        font-size: 11px !important;
        border-radius: 20px !important;
        letter-spacing: 1px !important;
    }

    /* Single product — sash: reduce padding so it doesn't overflow screen */
    .single-product .apo-badge-sash {
        top: 8px !important;
        right: -30px !important;
        padding: 9px clamp(28px, 5vw, 44px) !important;
        font-size: 10px !important;
    }
    .single-product .apo-badge-wrapper .apo-badge-sash {
        top: 62px !important;
        right: 20px !important;
        padding: 9px clamp(26px, 4.5vw, 42px) !important;
        font-size: 10px !important;
    }

    /* Single product — corner ribbon */
    .single-product .apo-badge-corner_ribbon::before {
        border-width: 80px 80px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon::after {
        border-width: 10px 10px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon-text {
        top: 28px !important;
        left: 20px !important;
        width: 70px !important;
        font-size: 8px !important;
        letter-spacing: 1px !important;
    }

    /* Classic shop — sash: shrink at mobile */
    .woocommerce ul.products li.product .apo-badge-sash {
        top: 24px !important;
        left: -22px !important;
        padding: 7px 28px !important;
        font-size: 9px !important;
    }

    /* Classic shop — corner ribbon: shrink at mobile */
    .woocommerce ul.products li.product .apo-badge-corner_ribbon::before {
        border-width: 60px 60px 0 0 !important;
    }
    .woocommerce ul.products li.product .apo-badge-corner_ribbon::after {
        border-width: 6px 6px 0 0 !important;
    }
    .woocommerce ul.products li.product .apo-badge-corner_ribbon-text {
        top: 16px !important;
        left: 4px !important;
        width: 52px !important;
        font-size: 6.5px !important;
    }

    /* Image badge — scale down */
    .single-product .apo-badge-image {
        max-width: 100px !important;
        top: 10px !important;
        right: 10px !important;
    }
    .woocommerce ul.products li.product .apo-badge-image {
        max-width: 60px !important;
    }

    /* Countdown — general mobile */
    .apo-countdown-wrapper {
        padding: 12px 14px;
        width: 100%;
        box-sizing: border-box;
    }
    .apo-countdown-heading {
        font-size: 16px;
        margin-bottom: 16px;
    }
    .apo-countdown-timer {
        gap: 10px;
        width: 100%;
        justify-content: space-around;
    }
    .apo-countdown-item {
        min-width: 48px;
        padding: 9px 7px 6px;
    }
    .apo-countdown-value {
        font-size: 20px;
    }
    /* Shop page countdown — compact, full width */
    .woocommerce ul.products li.product .apo-countdown-wrapper {
        margin: 8px 0;
        width: 100%;
    }
    .woocommerce ul.products li.product .apo-countdown-timer {
        justify-content: center;
    }
}

/* ── Small Mobile (≤ 480px) ──────────────────────────────────── */
@media (max-width: 480px) {
    /* Single product — text pill */
    .single-product .apo-badge-text_pill {
        top: 12px !important;
        right: 12px !important;
        padding: 5px 10px !important;
        font-size: 10px !important;
        border-radius: 15px !important;
        letter-spacing: 0.5px !important;
    }

    /* Single product — sash: narrowest padding to stay on-screen */
    .single-product .apo-badge-sash {
        top: 6px !important;
        right: -22px !important;
        padding: 7px clamp(20px, 4vw, 34px) !important;
        font-size: 9px !important;
    }
    .single-product .apo-badge-wrapper .apo-badge-sash {
        top: 58px !important;
        right: 15px !important;
        padding: 7px clamp(18px, 3.5vw, 32px) !important;
        font-size: 9px !important;
    }

    /* Single product — corner ribbon */
    .single-product .apo-badge-corner_ribbon::before {
        border-width: 60px 60px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon::after {
        border-width: 7px 7px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon-text {
        top: 20px !important;
        left: 12px !important;
        width: 52px !important;
        font-size: 7px !important;
        letter-spacing: 0.6px !important;
    }

    /* Classic shop — sash: smallest size */
    .woocommerce ul.products li.product .apo-badge-sash {
        top: 20px !important;
        left: -18px !important;
        padding: 6px 22px !important;
        font-size: 8px !important;
        letter-spacing: 0.8px !important;
    }

    /* Classic shop — corner ribbon: smallest size */
    .woocommerce ul.products li.product .apo-badge-corner_ribbon::before {
        border-width: 50px 50px 0 0 !important;
    }
    .woocommerce ul.products li.product .apo-badge-corner_ribbon-text {
        top: 13px !important;
        left: 3px !important;
        width: 44px !important;
        font-size: 6px !important;
    }

    /* Classic shop — text pill */
    .woocommerce ul.products li.product .apo-badge-text_pill {
        padding: 4px 8px !important;
        font-size: 9px !important;
    }

    /* Image badge */
    .single-product .apo-badge-image {
        max-width: 70px !important;
        top: 8px !important;
        right: 8px !important;
    }
    .woocommerce ul.products li.product .apo-badge-image {
        max-width: 50px !important;
    }

    /* Countdown */
    .apo-countdown-wrapper {
        padding: 10px;
        border-radius: 10px;
    }
    .apo-countdown-heading {
        font-size: 14px;
        margin-bottom: 12px;
    }
    .apo-countdown-timer {
        gap: 6px;
    }
    .apo-countdown-item {
        min-width: 0;
        flex: 1 1 auto;
        max-width: 70px;
        padding: 7px 4px 5px;
        border-radius: 6px !important;
    }
    .apo-countdown-value {
        font-size: 18px;
    }
    .apo-countdown-label {
        font-size: 7px;
        letter-spacing: 0.4px;
    }
    /* Single product: fill full width */
    .single-product .apo-countdown-wrapper {
        width: 100%;
    }
    .single-product .apo-countdown-timer {
        width: 100%;
        display: flex;
        justify-content: space-evenly;
    }
}

/* ── Extra Small (≤ 360px) ──────────────────────────────────── */
@media (max-width: 360px) {
    /* Single product — text pill */
    .single-product .apo-badge-text_pill {
        padding: 4px 8px !important;
        font-size: 9px !important;
    }

    /* Single product — sash: absolute minimum */
    .single-product .apo-badge-sash {
        right: -18px !important;
        padding: 6px clamp(14px, 3vw, 24px) !important;
        font-size: 8px !important;
        letter-spacing: 0.8px !important;
    }
    .single-product .apo-badge-wrapper .apo-badge-sash {
        padding: 6px clamp(12px, 2.5vw, 22px) !important;
        font-size: 8px !important;
    }

    /* Single product — corner ribbon */
    .single-product .apo-badge-corner_ribbon::before {
        border-width: 48px 48px 0 0 !important;
    }
    .single-product .apo-badge-corner_ribbon-text {
        top: 15px !important;
        left: 8px !important;
        width: 42px !important;
        font-size: 6px !important;
    }

    /* Classic shop — sash: absolute minimum at 360px */
    .woocommerce ul.products li.product .apo-badge-sash {
        top: 16px !important;
        left: -14px !important;
        padding: 5px 18px !important;
        font-size: 7px !important;
        letter-spacing: 0.5px !important;
    }

    /* Classic shop — corner ribbon: absolute minimum */
    .woocommerce ul.products li.product .apo-badge-corner_ribbon::before {
        border-width: 44px 44px 0 0 !important;
    }
    .woocommerce ul.products li.product .apo-badge-corner_ribbon-text {
        top: 11px !important;
        left: 2px !important;
        width: 38px !important;
        font-size: 5.5px !important;
    }

    /* Countdown */
    .apo-countdown-wrapper {
        padding: 8px;
    }
    .apo-countdown-timer {
        gap: 4px;
    }
    .apo-countdown-item {
        max-width: 60px;
        padding: 6px 3px 4px;
    }
    .apo-countdown-value {
        font-size: 16px;
    }
    .apo-countdown-label {
        font-size: 6px;
    }
}




/* Badge positioning on single product */
.single-product .apo-preorder-badge {
	margin-bottom: 15px;
}

/* ============================================
   CLASSIC THEME SHOP / ARCHIVE — Badge Positioning
   ============================================ */

/* The product <li> is the positioning anchor for ALL badges.
   overflow: visible is essential — Storefront sets overflow: hidden
   on li.product which clips rotated sashes. We must override it
   on every ancestor in the stacking chain. */
.woocommerce ul.products li.product,
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
.woocommerce ul.products li.product .product-image,
.woocommerce ul.products li.product .attachment-woocommerce_thumbnail,
.woocommerce ul.products li.product img {
	overflow: visible !important;
}

/* Stable positioning context on the card */
.woocommerce ul.products li.product {
	position: relative !important;
}

/* All badge types: absolutely positioned inside the card */
.woocommerce ul.products li.product .apo-preorder-badge {
	position: absolute !important;
	z-index: 100 !important;
}

/* ── Text Pill — top-left of image ── */
.woocommerce ul.products li.product .apo-badge-text_pill {
	top: 10px !important;
	left: 10px !important;
	right: auto !important;
}

/* ── Corner Ribbon — top-left corner ── */
.woocommerce ul.products li.product .apo-badge-corner_ribbon {
	top: 0 !important;
	left: 0 !important;
	right: auto !important;
}

/* ── Sash — diagonal from top-left corner ──
   Positioned at the top-left and rotated -45deg.
   The large negative left value lets the band extend past the card edge.
   overflow: visible on all ancestors (set above) prevents clipping. */
.woocommerce ul.products li.product .apo-badge-sash {
	top: 32px !important;
	left: -28px !important;
	right: auto !important;
	transform: rotate(-45deg) !important;
	padding: 8px 36px !important;
	font-size: 10px !important;
	z-index: 100 !important;
	white-space: nowrap !important;
}

/* ============================================
   Availability Text Styles
   ============================================ */

.apo-availability-text {
	margin: 10px 0;
	font-size: 14px;
	color: #666;
	font-style: italic;
}

.single-product .apo-availability-text {
	margin-top: 10px;
	margin-bottom: 15px;
	display: block !important;
	visibility: visible !important;
}

/* Variable product availability text - always visible */
.single-product .apo-availability-text.variable-product-availability {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.woocommerce ul.products li.product .apo-availability-text {
	margin-top: 5px;
	margin-bottom: 10px;
}

/* ============================================
   Countdown Timer Styles - Luxury Premium Design
   Warm cream container, white cards, amber typography
   ============================================ */

/* Wrapper container — cream background with dashed gold border */
.apo-countdown-wrapper {
	/* background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%); */
	border: 2px dashed var(--countdown-color, #d4a017);
	border-radius: 12px;
	padding: 14px 18px;
	margin: 15px 0;
	/* Fit content so it doesn't stretch full-width */
	display: inline-block;
	max-width: 100%;
	box-sizing: border-box;
}

/* Heading — "Offer Expires In" */
.apo-countdown-heading {
	display: block;
	font-size: 18px;
	font-weight: 700;
	color: #1a1a2e;
	margin-bottom: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Timer row — wraps on very small screens so cards never overflow */
.apo-countdown-timer {
	display: flex;
	gap: 12px;
	padding: 0;
	margin: 0;
	justify-content: flex-start;
	align-items: center;
	flex-wrap: wrap;
	max-width: 100%;
}

/* Individual number cards — white with subtle border */
.apo-countdown-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 50px;
	padding: 10px 8px 7px;
	background: #ffffff !important;
	border: 1px solid var(--countdown-color, #e5d9a8) !important;
	border-radius: 8px !important;
	box-shadow: 0 2px 8px var(--countdown-item-shadow, rgba(0, 0, 0, 0.05)) !important;
	position: relative;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.apo-countdown-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px var(--countdown-item-shadow, rgba(0, 0, 0, 0.1)) !important;
}

/* Remove pseudo-elements from any previous design */
.apo-countdown-item::before,
.apo-countdown-item::after {
	display: none !important;
}

/* Number values — amber/brown */
.apo-countdown-value {
	font-size: 22px;
	font-weight: 700;
	color: var(--countdown-color, #b45309);
	line-height: 1;
	margin-bottom: 3px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	letter-spacing: -0.5px;
}

/* Labels — dark brown uppercase */
.apo-countdown-label {
	font-size: 8px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--countdown-color, #78350f);
	letter-spacing: 0.8px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Single Product Page ---- */
.single-product .apo-countdown-wrapper {
	display: inline-block;
	padding: 16px 20px;
	margin: 16px 0;
	/* Fluid: never wider than the summary column, but never overflows on small screens */
	max-width: 100%;
	box-sizing: border-box;
}

.single-product .apo-countdown-heading {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: var(--countdown-color, #78350f);
	margin-bottom: 12px;
}

.single-product .apo-countdown-timer {
	gap: 10px;
	justify-content: flex-start;
}

.single-product .apo-countdown-item {
	min-width: 58px;
	padding: 10px 10px 8px;
}

.single-product .apo-countdown-value {
	font-size: 24px;
	margin-bottom: 4px;
}

.single-product .apo-countdown-label {
	font-size: 9px;
	letter-spacing: 1.2px;
}

/* ---- Shop / Archive Pages ---- */
.woocommerce ul.products li.product .apo-countdown-wrapper {
	padding: 12px;
	margin: 10px 0;
	border-radius: 10px;
	/* width: 100%; */
	box-sizing: border-box;
}

.woocommerce ul.products li.product .apo-countdown-heading {
	font-size: 13px;
	margin-bottom: 12px;
}

.woocommerce ul.products li.product .apo-countdown-timer {
	gap: 8px;
}

.woocommerce ul.products li.product .apo-countdown-item {
	min-width: 42px;
	padding: 8px 6px 6px;
	border-radius: 6px !important;
}

.woocommerce ul.products li.product .apo-countdown-value {
	font-size: 16px;
	margin-bottom: 2px;
}

.woocommerce ul.products li.product .apo-countdown-label {
	font-size: 6px;
	letter-spacing: 0.5px;
}

/* ---- Responsive — Countdown Timer ---- */
/* All countdown responsive rules are consolidated in the
   "RESPONSIVE — Badges" section above (shared breakpoints). */

/* ============================================
   Variable Product Dynamic Updates
   ============================================ */

/* Variable products: Show badge immediately if any variation is pre-order */
.single-product .apo-badge-wrapper {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}



/* ============================================
   SASH BADGE - IMPROVED DESIGN
   Shows upper and lower edges without clipping
   Uses color from Display settings
   ============================================ */

.apo-badge-sash {
    position: absolute;
    top: 15px;
    right: -35px;
    padding: 10px 50px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    transform: rotate(45deg);
    z-index: 100;
    overflow: visible;
    white-space: nowrap;
    line-height: 1.2;
    color: var(--badge-text-color, #ffffff);
    /* Use CSS custom property for dynamic color */
    background: linear-gradient(
        to bottom, 
        rgba(255, 255, 255, 0.15) 0%, 
        transparent 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    background-color: var(--badge-color, #e91e63);
    background-blend-mode: overlay;
    /* Simple shadow for depth */
    box-shadow: 
        0 3px 10px rgba(0, 0, 0, 0.3), 
        0 1px 3px rgba(0, 0, 0, 0.2);
    /* Subtle text shadow for readability */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Shop/Archive page — sash sizing (position handled in badge section above) */
.woocommerce ul.products li.product .apo-badge-sash {
    top: 39px !important;
    left: -36px !important;
    padding: 8px 22px !important;
    font-size: 10px !important;
    letter-spacing: 1px !important;
    transform: rotate(-45deg) !important;
}

/* Single product page - improved positioning to prevent clipping */
.single-product .apo-badge-sash {
    top: 10px !important;
    right: -40px !important;
    /* Fluid horizontal padding: wide enough to fill the diagonal band at all sizes */
    padding: 12px clamp(36px, 8vw, 60px) !important;
    font-size: clamp(9px, 1.1vw, 11px) !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    /* Use CSS custom property from Display settings */
    background: linear-gradient(
        to bottom, 
        rgba(255, 255, 255, 0.15) 0%, 
        transparent 50%,
        rgba(0, 0, 0, 0.1) 100%
    ) !important;
    background-color: var(--badge-color, #e91e63) !important;
    background-blend-mode: overlay !important;
    /* Enhanced shadow for single product */
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.35), 
        0 2px 5px rgba(0, 0, 0, 0.25) !important;
    /* Text shadow for better readability */
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.4),
        0 0 1px rgba(255, 255, 255, 0.2) !important;
    transform: rotate(45deg) !important;
    z-index: 999 !important;
    overflow: visible !important;
    white-space: nowrap !important;
}

/* Badges inside wrapper - position relative to the extended wrapper area.
   Wrapper extends -50px on all sides, so we compensate: desired_pos + 50px. */
.single-product .apo-badge-wrapper .apo-badge-sash {
    top: 79px !important;  /* 50 + 29 */
    right: 0px !important; /* 50 - 50 = 0 (sash overhangs to the right) */
    /* Fluid padding so the band stays proportional at all gallery widths */
    padding: 10px clamp(36px, 7vw, 50px) !important;
    font-size: clamp(9px, 1.1vw, 11px) !important;
}

.single-product .apo-badge-wrapper .apo-badge-text_pill {
    top: 65px !important;  /* 50 + 15 */
    right: 98px !important; /* 50 + 48 */
}

.single-product .apo-badge-wrapper .apo-badge-corner_ribbon {
    top: 50px !important;  /* 50 + 0 */
    right: 50px !important; /* 50 + 0 — corner anchor, left:50px overrides */
}

/* If badge is added directly to gallery image by JS (fallback) */
.single-product .woocommerce-product-gallery__image > .apo-badge-sash:not(.apo-badge-wrapper *),
.single-product .flex-active-slide > .apo-badge-sash:not(.apo-badge-wrapper *) {
    top: 15px !important;
    right: -35px !important;
}

/* Folded edges for sash - both upper and lower */
/* These create the 3D ribbon effect */
.single-product .apo-badge-sash::before,
.single-product .apo-badge-sash::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: -1;
}

/* Left fold (lower edge) */
.single-product .apo-badge-sash::before {
    left: 0;
    top: 100%;
    border-width: 0 20px 15px 0;
    border-color: transparent var(--badge-shadow-color, rgba(139, 30, 63, 0.9)) transparent transparent;
}

/* Right fold (lower edge) */
.single-product .apo-badge-sash::after {
    right: 0;
    top: 100%;
    border-width: 0 0 15px 20px;
    border-color: transparent transparent transparent var(--badge-shadow-color, rgba(139, 30, 63, 0.9));
}

/* Hover effect for single product sash */
.single-product .apo-badge-sash:hover {
    transform: rotate(45deg) scale(1.02) !important;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.4), 
        0 3px 7px rgba(0, 0, 0, 0.3) !important;
}




/* ============================================
   Image Badge Styles
   ============================================ */

/* Image Badge - Base styles */
.apo-badge-image {
display: inline-block;
max-width: 120px !important;
height: auto;
position: absolute;
top: 10px;
right: 10px;
z-index: 100;
border: none;
padding: 0;
background: transparent;
/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); */
border-radius: 0;
}

/* Image Badge - Single Product Page */
.single-product .apo-badge-image {
max-width: 150px;
top: 15px;
right: 15px;
}

/* Image Badge - Shop/Archive Pages */
.woocommerce ul.products li.product .apo-badge-image {
max-width: 80px;
top: 8px;
right: 8px;
}

/* Image Badge - Shop/Archive Pages (force top-right on listing pages only) */
.post-type-archive-product .woocommerce ul.products li.product .apo-badge-image,
.tax-product_cat .woocommerce ul.products li.product .apo-badge-image,
.woocommerce-shop .woocommerce ul.products li.product .apo-badge-image {
	top: 10px !important;
	right: 10px !important;
}

/* When an image badge is used on the single product page, hide all other
   text-based preorder badges (including variation-specific ones) so only
   the image badge is visible. */
body.single-product:has(.apo-badge-image) .apo-preorder-badge:not(.apo-badge-image) {
	display: none !important;
}

/* Ensure image badges don't inherit text badge colors */
.apo-badge-image {
color: inherit;
background-color: transparent !important;
background-image: none !important;
}
