/**
 * Category Discount Pro - Frontend Styles
 * USA Patriotic Theme: Red, White, Blue
 * Performance optimized with CSS-only animations
 */

/* CSS Variables */
:root {
    --cdp-red: #B22234;
    --cdp-red-dark: #8B1A28;
    --cdp-red-light: #E63946;
    --cdp-blue: #3C3B6E;
    --cdp-blue-light: #4A5899;
    --cdp-blue-dark: #2A2A4E;
    --cdp-white: #FFFFFF;
    --cdp-gold: #FFD700;
    --cdp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --cdp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

/* ================================================
   DISCOUNT BADGES - USA STYLE
   ================================================ */

.cdp-discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    pointer-events: none;
}

/* USA Patriotic Style */
.cdp-badge-usa {
    background: linear-gradient(135deg, var(--cdp-blue) 0%, var(--cdp-blue-dark) 100%);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    box-shadow: var(--cdp-shadow-lg);
    border: 2px solid var(--cdp-white);
    min-width: 60px;
}

.cdp-badge-usa .cdp-badge-inner {
    position: relative;
    padding: 8px 12px;
    text-align: center;
}

.cdp-badge-usa .cdp-badge-stars {
    display: block;
    font-size: 10px;
    color: var(--cdp-gold);
    letter-spacing: 3px;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.cdp-badge-usa .cdp-badge-percent {
    display: block;
    font-size: 22px;
    font-weight: 900;
    color: var(--cdp-white);
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cdp-badge-usa .cdp-badge-off {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--cdp-gold);
    letter-spacing: 2px;
    margin-top: 2px;
}

.cdp-badge-usa .cdp-badge-stripe {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--cdp-red) 0px,
        var(--cdp-red) 8px,
        var(--cdp-white) 8px,
        var(--cdp-white) 16px
    );
}

/* Large badge for single product */
.cdp-badge-large.cdp-badge-usa {
    min-width: 80px;
}

.cdp-badge-large.cdp-badge-usa .cdp-badge-inner {
    padding: 12px 18px;
}

.cdp-badge-large.cdp-badge-usa .cdp-badge-stars {
    font-size: 12px;
}

.cdp-badge-large.cdp-badge-usa .cdp-badge-percent {
    font-size: 32px;
}

.cdp-badge-large.cdp-badge-usa .cdp-badge-off {
    font-size: 13px;
}

/* Modern Minimal Style */
.cdp-badge-modern {
    background: var(--cdp-blue-dark);
    color: var(--cdp-white);
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: var(--cdp-shadow);
}

.cdp-badge-modern .cdp-badge-text {
    letter-spacing: 0.5px;
}

.cdp-badge-large.cdp-badge-modern {
    padding: 12px 20px;
    font-size: 18px;
}

/* Bold & Bright Style */
.cdp-badge-bold {
    background: linear-gradient(135deg, var(--cdp-red) 0%, var(--cdp-red-dark) 100%);
    color: var(--cdp-white);
    padding: 10px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--cdp-shadow-lg);
}

.cdp-badge-bold .cdp-badge-fire {
    font-size: 16px;
}

.cdp-badge-bold .cdp-badge-text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.cdp-badge-large.cdp-badge-bold {
    padding: 14px 24px;
}

.cdp-badge-large.cdp-badge-bold .cdp-badge-fire {
    font-size: 20px;
}

.cdp-badge-large.cdp-badge-bold .cdp-badge-text {
    font-size: 18px;
}

/* ================================================
   ANIMATIONS (CSS-only for performance)
   ================================================ */

.cdp-animated {
    animation: cdp-badge-entrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cdp-badge-entrance {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Subtle pulse on hover */
.cdp-discount-badge:hover {
    animation: cdp-badge-pulse 0.6s ease-in-out;
}

@keyframes cdp-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Star twinkle animation for USA style */
.cdp-badge-usa .cdp-badge-stars {
    animation: cdp-star-twinkle 2s ease-in-out infinite;
}

@keyframes cdp-star-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}


/* ================================================
   CATEGORY BANNER
   ================================================ */

.cdp-category-banner {
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--cdp-shadow-lg);
}

.cdp-banner-usa {
    background: linear-gradient(135deg, var(--cdp-blue) 0%, var(--cdp-blue-dark) 60%, var(--cdp-red) 100%);
    position: relative;
}

.cdp-banner-usa::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--cdp-red) 0px,
        var(--cdp-red) 30px,
        var(--cdp-white) 30px,
        var(--cdp-white) 60px
    );
}

.cdp-banner-usa::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--cdp-white) 0px,
        var(--cdp-white) 30px,
        var(--cdp-red) 30px,
        var(--cdp-red) 60px
    );
}

.cdp-banner-modern {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
}

.cdp-banner-bold {
    background: linear-gradient(135deg, var(--cdp-red) 0%, #DC2626 100%);
}

.cdp-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px 30px;
    position: relative;
    z-index: 1;
}

.cdp-banner-icon {
    font-size: 40px;
    animation: cdp-bounce 2s ease-in-out infinite;
}

@keyframes cdp-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.cdp-banner-text {
    flex: 1;
}

.cdp-banner-title {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: var(--cdp-white);
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.cdp-banner-discount {
    display: block;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.cdp-banner-discount::before {
    content: '★ ';
    color: var(--cdp-gold);
}

.cdp-banner-expires {
    text-align: right;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.cdp-expires-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cdp-expires-date {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--cdp-white);
}


/* ================================================
   PRODUCT LOOP ADJUSTMENTS
   ================================================ */

.woocommerce ul.products li.product {
    position: relative;
}

/* Hide default WooCommerce sale badge when our badge is shown */
.woocommerce ul.products li.product .cdp-discount-badge ~ .onsale,
.woocommerce div.product .cdp-single-product-badge ~ .onsale,
.woocommerce div.product .cdp-single-product-badge ~ .images .onsale {
    display: none;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

@media (max-width: 768px) {
    .cdp-banner-content {
        flex-direction: column;
        text-align: center;
        padding: 20px;
        gap: 15px;
    }
    
    .cdp-banner-icon {
        font-size: 32px;
    }
    
    .cdp-banner-title {
        font-size: 20px;
    }
    
    .cdp-banner-discount {
        font-size: 14px;
    }
    
    .cdp-banner-expires {
        text-align: center;
    }
    
    .cdp-banner-coupon {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .cdp-discount-badge {
        top: 5px;
        left: 5px;
    }
    
    .cdp-badge-usa .cdp-badge-inner {
        padding: 6px 10px;
    }
    
    .cdp-badge-usa .cdp-badge-percent {
        font-size: 18px;
    }
    
    .cdp-badge-usa .cdp-badge-stars {
        font-size: 8px;
    }
    
    .cdp-badge-usa .cdp-badge-off {
        font-size: 9px;
    }
}

/* ================================================
   PRINT STYLES
   ================================================ */

@media print {
    .cdp-discount-badge,
    .cdp-category-banner {
        display: none !important;
    }
}

/* ================================================
   ACCESSIBILITY
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .cdp-animated,
    .cdp-discount-badge,
    .cdp-banner-icon,
    .cdp-badge-usa .cdp-badge-stars {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cdp-discount-badge {
        border: 3px solid #000 !important;
    }
    
    .cdp-savings {
        border: 2px solid currentColor;
    }
}

/* ================================================
   DISCOUNT COUPON TAG - USA Theme with Scalloped Border
   ================================================ */

.cdp-coupon-tag {
    display: inline-block;
    margin: 15px 0;
    max-width: 100%;
    position: relative;
}

/* Scalloped/Zigzag Border at Top - Red & White USA */
.cdp-tag-scallop {
    height: 12px;
    background: 
        linear-gradient(135deg, var(--cdp-red) 25%, transparent 25%) -10px 0,
        linear-gradient(225deg, var(--cdp-red) 25%, transparent 25%) -10px 0,
        linear-gradient(315deg, var(--cdp-red) 25%, transparent 25%),
        linear-gradient(45deg, var(--cdp-red) 25%, transparent 25%);
    background-size: 20px 12px;
    background-color: var(--cdp-white);
    border-radius: 10px 10px 0 0;
}

/* Main Card Body */
.cdp-tag-main {
    background: linear-gradient(135deg, var(--cdp-blue) 0%, var(--cdp-blue-dark) 100%);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 20px rgba(60, 59, 110, 0.4);
    overflow: hidden;
}

/* Happy New Year Header */
.cdp-tag-header {
    background: var(--cdp-red);
    padding: 5px 15px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    color: var(--cdp-white);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.cdp-tag-header::before {
    content: '🎆 ';
}

.cdp-tag-header::after {
    content: ' 🎇';
}

/* Body Content */
.cdp-tag-body {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
}

/* Ticket Icon - USA Style */
.cdp-tag-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.4);
}

.cdp-tag-content {
    flex: 1;
    min-width: 0;
}

/* Discount Text - Gold/Yellow */
.cdp-tag-discount {
    font-size: 18px;
    font-weight: 900;
    color: #D4AF37;
    margin-bottom: 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

/* Code Section */
.cdp-tag-code {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cdp-code-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.cdp-code-value {
    background: rgba(60, 59, 110, 0.6);
    color: #fff;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 1.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cdp-code-value:hover {
    background: rgba(60, 59, 110, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Apply Button - Dark Red USA */
.cdp-tag-apply {
    background: var(--cdp-red-dark);
    color: var(--cdp-white);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 3px 10px rgba(139, 26, 40, 0.4);
}

.cdp-tag-apply:hover {
    background: var(--cdp-red);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 26, 40, 0.5);
}

.cdp-tag-apply:active {
    transform: translateY(0);
}

.cdp-tag-apply.cdp-loading {
    opacity: 0.7;
    pointer-events: none;
}

.cdp-tag-apply.cdp-success {
    background: #10B981 !important;
    cursor: default;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4);
}

/* Activated State */
.cdp-coupon-tag.cdp-activated .cdp-tag-scallop {
    background: 
        linear-gradient(135deg, #10B981 25%, transparent 25%) -10px 0,
        linear-gradient(225deg, #10B981 25%, transparent 25%) -10px 0,
        linear-gradient(315deg, #10B981 25%, transparent 25%),
        linear-gradient(45deg, #10B981 25%, transparent 25%);
    background-size: 20px 12px;
    background-color: var(--cdp-white);
}

.cdp-coupon-tag.cdp-activated .cdp-tag-header {
    background: #10B981;
}

.cdp-coupon-tag.cdp-activated .cdp-tag-main {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.cdp-coupon-tag.cdp-activated .cdp-tag-discount::after {
    content: ' ✓';
    color: #10B981;
}

/* Responsive */
@media (max-width: 480px) {
    .cdp-coupon-tag {
        display: block;
        width: 100%;
    }
    
    .cdp-tag-body {
        flex-wrap: wrap;
        padding: 12px 15px;
    }
    
    .cdp-tag-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .cdp-tag-discount {
        font-size: 16px;
    }
    
    .cdp-tag-apply {
        width: 100%;
        margin-top: 10px;
        padding: 10px 20px;
    }
}

/* ================================================
   BANNER COUPON SECTION
   ================================================ */

.cdp-banner-coupon {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 15px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.cdp-banner-code {
    font-family: monospace;
    font-size: 16px;
    font-weight: 800;
    color: var(--cdp-gold);
    letter-spacing: 1px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.4);
}

.cdp-banner-apply {
    padding: 8px 16px;
    background: var(--cdp-red);
    color: var(--cdp-white);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cdp-banner-apply:hover {
    background: var(--cdp-red-dark);
    transform: scale(1.05);
}

.cdp-banner-apply.cdp-success {
    background: #10B981;
}


