/**
 * Kolchikayn Promotional Products - Frontend Styles
 * Version: 1.0.0
 */

/* ===== PROMOTIONAL BADGES ===== */

/* Base promotional badge styles */
.kpp-promotional-badge {
    display: inline-block;
    position: relative;
    z-index: 10;
    font-family: inherit;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: kpp-pulse 2s infinite;
}

.kpp-badge-text {
    display: block;
    padding: 4px 8px;
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
    color: #ffffff;
    border-radius: 8px;
    font-size: clamp(10px, 2.5vw, 16px);
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    word-break: break-word;
    text-align: center;
    white-space: normal;
    overflow: visible;
    pointer-events: auto;

    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

/* Shop/Archive page badge */
.kpp-badge-shop {
    position: absolute;
    top: 10px;
    right: 8px;
    z-index: 15;
    max-width: 45%;
    pointer-events: none;
}

/* Single product page badge */
.kpp-badge-single {
    margin: 15px 0 20px 0;
    text-align: center;
    animation: kpp-pulse-strong 2s infinite;
}

.kpp-badge-single .kpp-badge-text {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 12px;
    display: inline-block;
    position: relative;
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 50%, #e55039 100%);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.5);
    border: 3px solid #ffffff;
    font-weight: 900;
    letter-spacing: 1.5px;
}

.kpp-badge-single .kpp-badge-text::before {
    content: "🔥";
    margin-right: 8px;
    font-size: 18px;
    animation: kpp-fire-flicker 1s infinite alternate;
}

.kpp-badge-single .kpp-badge-text::after {
    content: "🔥";
    margin-left: 8px;
    font-size: 18px;
    animation: kpp-fire-flicker 1s infinite alternate-reverse;
}

/* Badge alignment styles */
.kpp-align-left {
    text-align: left;
}

.kpp-align-center {
    text-align: center;
}

.kpp-align-right {
    text-align: right;
}

/* Badge style variations */
.kpp-style-simple .kpp-badge-text::before,
.kpp-style-simple .kpp-badge-text::after {
    display: none;
}

.kpp-style-simple .kpp-icon-before,
.kpp-style-simple .kpp-icon-after {
    display: none;
}

.kpp-style-star .kpp-icon-before,
.kpp-style-star .kpp-icon-after {
    animation: kpp-star-twinkle 1.5s ease-in-out infinite alternate;
}

.kpp-style-lightning .kpp-icon-before,
.kpp-style-lightning .kpp-icon-after {
    animation: kpp-lightning-flash 0.8s ease-in-out infinite;
}

.kpp-style-crown .kpp-icon-before,
.kpp-style-crown .kpp-icon-after {
    animation: kpp-crown-glow 2s ease-in-out infinite alternate;
}

/* Cart badge */
.kpp-badge-cart {
    margin-left: 8px;
    font-size: 10px;
    padding: 2px 6px;
    background: #ff4757;
    color: #ffffff;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== COUNTDOWN TIMER ===== */

.kpp-countdown-container {
    background: linear-gradient(135deg, #fff5f5 0%, #fef7f7 50%, #fff0f0 100%);
    border: 3px solid #ff4757;
    border-radius: 15px;
    padding: 25px;
    margin: 25px 0;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.3);
    position: relative;
    overflow: hidden;
}

.kpp-countdown-container::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff4757, #ff3742, #e55039, #ff4757);
    background-size: 400% 400%;
    border-radius: 15px;
    z-index: -1;
    animation: kpp-border-glow 3s ease infinite;
}

.kpp-countdown-title {
    font-size: 18px;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kpp-countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.kpp-countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    background: #ffffff;
    border-radius: 8px;
    padding: 12px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.kpp-countdown-number {
    font-size: 24px;
    font-weight: 700;
    color: #ff4757;
    line-height: 1;
    margin-bottom: 4px;
    font-family: 'Arial', sans-serif;
}

.kpp-countdown-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== ANIMATIONS ===== */

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

@keyframes kpp-pulse-strong {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.08);
        filter: brightness(1.2);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes kpp-fire-flicker {
    0% {
        transform: rotate(-2deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(2deg) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: rotate(-1deg) scale(0.95);
        opacity: 1;
    }
}

@keyframes kpp-border-glow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes kpp-star-twinkle {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.7;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

@keyframes kpp-lightning-flash {
    0%, 90% {
        opacity: 1;
        transform: scale(1);
    }
    95% {
        opacity: 0.3;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes kpp-crown-glow {
    0% {
        filter: drop-shadow(0 0 5px gold);
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 15px gold);
        transform: scale(1.05);
    }
}

@keyframes kpp-countdown-flash {
    0%, 100% {
        background-color: #ffffff;
    }
    50% {
        background-color: #fff5f5;
    }
}

/* Flash animation for urgent countdown */
.kpp-countdown-urgent .kpp-countdown-item {
    animation: kpp-countdown-flash 1s infinite;
}

.kpp-countdown-urgent .kpp-countdown-number {
    color: #dc3545;
}

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

@media (max-width: 768px) {
    .kpp-badge-shop {
        top: 8px;
        right: 5px;
        max-width: 55%;
    }

    .kpp-badge-shop .kpp-badge-text {
        padding: 3px 6px;
        font-size: clamp(9px, 3vw, 14px);
        letter-spacing: 0.2px;
        line-height: 1.1;
    }
    
    .kpp-countdown-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .kpp-countdown-title {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .kpp-countdown-timer {
        gap: 10px;
    }
    
    .kpp-countdown-item {
        min-width: 50px;
        padding: 8px 6px;
    }
    
    .kpp-countdown-number {
        font-size: 20px;
    }
    
    .kpp-countdown-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .kpp-badge-shop {
        top: 6px;
        right: 3px;
        max-width: 60%;
    }

    .kpp-badge-shop .kpp-badge-text {
        padding: 2px 4px;
        font-size: clamp(8px, 4vw, 12px);
        letter-spacing: 0.1px;
        border-radius: 4px;
        line-height: 1.1;
    }

    .kpp-countdown-timer {
        gap: 8px;
    }

    .kpp-countdown-item {
        min-width: 45px;
        padding: 6px 4px;
    }

    .kpp-countdown-number {
        font-size: 18px;
    }

    .kpp-countdown-label {
        font-size: 9px;
    }
}

/* ===== WOODMART THEME INTEGRATION ===== */

/* Ensure badges work well with Woodmart product layouts */
.woodmart-hover-standard .kpp-badge-shop,
.woodmart-hover-alt .kpp-badge-shop,
.woodmart-hover-button .kpp-badge-shop {
    z-index: 20;
}

/* Product grid compatibility */
.product-grid-item .kpp-badge-shop {
    top: 12px;
    right: 8px;
    max-width: 45%;
}

/* Quick view compatibility */
.quick-view-popup .kpp-badge-single {
    margin-bottom: 10px;
}

.quick-view-popup .kpp-countdown-container {
    margin: 15px 0;
    padding: 15px;
}

/* Single product page integration */
.single-product-content .kpp-badge-single {
    margin-bottom: 20px;
}

.single-product-content .kpp-countdown-container {
    margin: 25px 0;
}

/* Additional responsive badge styles */
.kpp-badge-shop {
    /* Ensure badge doesn't overflow container */
    box-sizing: border-box;
}

/* For very long promotional messages */
@media (max-width: 320px) {
    .kpp-badge-shop {
        max-width: 65%;
        right: 2px;
    }

    .kpp-badge-shop .kpp-badge-text {
        font-size: clamp(7px, 5vw, 10px);
        padding: 2px 3px;
        line-height: 1.1;
    }
}

/* ===== PROMOTIONAL PRODUCTS SHORTCODE RESPONSIVE ===== */

/* Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .kpp-promotional-shortcode ul.products li.product {
        width: 48% !important;
        margin-right: 4% !important;
    }

    .kpp-promotional-shortcode ul.products li.product:nth-child(2n) {
        margin-right: 0 !important;
    }

    .kpp-promotional-shortcode ul.products li.product:nth-child(2n+1) {
        clear: both !important;
    }
}

/* Mobile responsive - 1 column */
@media (max-width: 768px) {
    .kpp-promotional-shortcode ul.products,
    .kpp-promotional-shortcode .products,
    .kpp-promotional-shortcode .woocommerce ul.products {
        display: block !important;
        grid-template-columns: 1fr !important;
        --wd-col: 1 !important;
    }

    .kpp-promotional-shortcode ul.products li.product,
    .kpp-promotional-shortcode .products li.product,
    .kpp-promotional-shortcode .woocommerce ul.products li.product {
        width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        margin-bottom: 25px !important;
        float: none !important;
        clear: both !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Reset any nth-child rules */
    .kpp-promotional-shortcode ul.products li.product:nth-child(n),
    .kpp-promotional-shortcode .products li.product:nth-child(n) {
        margin-right: 0 !important;
        clear: both !important;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .kpp-promotional-shortcode ul.products li.product,
    .kpp-promotional-shortcode .products li.product {
        margin-bottom: 20px !important;
    }
}

/* ===== PROMOTIONAL PRODUCT CARD WIDTH ===== */

/* Fixed width for promotional product cards */
.kpp-promotional-shortcode .wd-product.kpp-promotional-product,
.kpp-promotional-shortcode .product-grid-item.kpp-promotional-product,
.kpp-promotional-shortcode li.product.kpp-promotional-product {
    width: 300px !important;
    max-width: 300px !important;
    min-width: 300px !important;
    flex: 0 0 300px !important;
}

/* Ensure container can handle fixed width cards */
.kpp-promotional-shortcode ul.products,
.kpp-promotional-shortcode .products {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: flex-start !important;
}

/* Override for mobile - keep 1 column but allow 300px width if screen allows */
@media (max-width: 768px) {
    .kpp-promotional-shortcode .wd-product.kpp-promotional-product,
    .kpp-promotional-shortcode .product-grid-item.kpp-promotional-product,
    .kpp-promotional-shortcode li.product.kpp-promotional-product {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        flex: 0 0 100% !important;
        margin: 0 0 20px 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .kpp-promotional-shortcode ul.products,
    .kpp-promotional-shortcode .products {
        justify-content: flex-start !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Fix product image container spacing */
    .kpp-promotional-shortcode .product-grid-item .product-image-link,
    .kpp-promotional-shortcode .wd-product .product-image-link,
    .kpp-promotional-shortcode .product .product-image-link {
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* Fix hover effects that might cause spacing */
    .kpp-promotional-shortcode .product-grid-item .hover-img,
    .kpp-promotional-shortcode .wd-product .hover-img,
    .kpp-promotional-shortcode .product .hover-img {
        display: none !important;
    }

    /* Fix any button containers */
    .kpp-promotional-shortcode .product-grid-item .wd-buttons,
    .kpp-promotional-shortcode .wd-product .wd-buttons,
    .kpp-promotional-shortcode .product .wd-buttons {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Additional mobile fixes for spacing issues */
@media (max-width: 768px) {
    /* Remove any extra spacing from product containers */
    .kpp-promotional-shortcode .product-wrapper,
    .kpp-promotional-shortcode .product-element-top {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Fix product image wrapper */
    .kpp-promotional-shortcode .product-image-summary-wrap,
    .kpp-promotional-shortcode .product-image-summary {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Ensure no overflow or extra space */
    .kpp-promotional-shortcode .wd-product,
    .kpp-promotional-shortcode .product-grid-item {
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* Fix any grid or flex issues */
    .kpp-promotional-shortcode .wd-product > *,
    .kpp-promotional-shortcode .product-grid-item > * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* For very small screens, ensure full width */
@media (max-width: 480px) {
    .kpp-promotional-shortcode .wd-product.kpp-promotional-product,
    .kpp-promotional-shortcode .product-grid-item.kpp-promotional-product,
    .kpp-promotional-shortcode li.product.kpp-promotional-product {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        flex: 0 0 100% !important;
        margin: 0 0 15px 0 !important;
    }
}

/* ===== ADDITIONAL BADGE VARIATIONS ===== */

/* Alternative badge colors */
.kpp-promotional-badge.kpp-badge-orange .kpp-badge-text {
    background: linear-gradient(135deg, #ff9500 0%, #ff8c00 100%);
}

.kpp-promotional-badge.kpp-badge-green .kpp-badge-text {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.kpp-promotional-badge.kpp-badge-blue .kpp-badge-text {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

/* Badge with icon support */
.kpp-badge-text .kpp-badge-icon {
    margin-right: 4px;
    font-size: 10px;
}

/* ===== EXPIRED PROMOTION STYLES ===== */

.kpp-promotion-expired {
    opacity: 0.6;
    filter: grayscale(100%);
}

.kpp-promotion-expired .kpp-promotional-badge {
    display: none;
}

.kpp-countdown-expired {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.kpp-countdown-expired .kpp-countdown-title {
    color: #721c24;
}

.kpp-countdown-expired .kpp-countdown-number {
    color: #dc3545;
}

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

.kpp-promotional-badge:focus,
.kpp-countdown-container:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .kpp-badge-text {
        background: #000000;
        color: #ffffff;
        border: 2px solid #ffffff;
    }
    
    .kpp-countdown-container {
        border: 3px solid #000000;
        background: #ffffff;
    }
    
    .kpp-countdown-number {
        color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .kpp-promotional-badge {
        animation: none;
    }
    
    .kpp-countdown-urgent .kpp-countdown-item {
        animation: none;
    }
}

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

@media print {
    .kpp-promotional-badge,
    .kpp-countdown-container {
        display: none;
    }
}
