/* Customer Role Prices - Badge CSS */
/* Šo CSS var pievienot globālajā tēmas CSS failā vai ielādēt caur plugin */

/* Badge stils - pamata */
.crp-discount-badge {
    position: absolute;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: auto;
    cursor: help;
}

/* Black Friday badge stils (melna) - noklusējuma */
.crp-badge-black-friday {
    background: #000;
    color: #fff;
}

/* Standarta badge stils (zilā) */
.crp-badge-standard {
    background: #0073aa;
    color: #fff;
}

/* Tooltip stils - custom tooltip ar CSS - VIENMĒR kreisajā pusē */
.crp-discount-badge::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: auto;
    right: 0;
    transform: none;
    padding: 10px 14px;
    background: #333;
    color: #fff;
    font-size: 12px;
    white-space: normal;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 999999;
    max-width: 280px;
    min-width: 180px;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
    line-height: 1.5;
    font-weight: normal;
}

.crp-discount-badge::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: auto;
    right: 15px;
    transform: none;
    border: 8px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 999999;
}

/* Single product lapā - tooltip KREISAJĀ pusē, sākas no badge kreisās malas */
.single-product .crp-discount-badge::after {
    left: 0 !important;
    right: auto !important;
}

.single-product .crp-discount-badge::before {
    left: 15px !important;
    right: auto !important;
    border-top-color: #333 !important;
    border-right-color: transparent !important;
}

.crp-discount-badge:hover::after,
.crp-discount-badge:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Ja title nav, paslēpjam tooltip */
.crp-discount-badge:not([title])::after,
.crp-discount-badge:not([title])::before {
    display: none;
}

/* Izvairāmies no klikšķiem uz badge saturu - novirzām uz bildi */
.crp-discount-badge * {
    pointer-events: none;
}

/* Responsive tooltip */
@media (max-width: 768px) {
    .crp-discount-badge::after {
        max-width: 200px;
        min-width: 120px;
        font-size: 11px;
        padding: 8px 10px;
    }
}

/* PASLĒPT badge no related/upsell produktiem */
.related .crp-discount-badge,
.upsells .crp-discount-badge,
.cross-sells .crp-discount-badge,
.woocommerce .related .crp-discount-badge,
.woocommerce .upsells .crp-discount-badge,
section.related .crp-discount-badge,
section.upsells .crp-discount-badge,
.products.related .crp-discount-badge,
.products.upsells .crp-discount-badge,
.single-product section.related .crp-discount-badge,
.single-product section.upsells .crp-discount-badge,
.single-product .products.related .crp-discount-badge,
.single-product .products.upsells .crp-discount-badge,
.woocommerce .related .product .crp-discount-badge,
.woocommerce .upsells .product .crp-discount-badge,
.related .product .crp-discount-badge,
.upsells .product .crp-discount-badge,
.flex-control-thumbs .crp-discount-badge,
.flex-control-nav .crp-discount-badge,
.woocommerce-product-gallery__thumbs .crp-discount-badge,
.thumbnails .crp-discount-badge,
.woocommerce-product-gallery__image:not(.flex-active-slide):not(:first-child) .crp-discount-badge {
    display: none !important;
}

.crp-badge-text {
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

.crp-badge-discount {
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.crp-badge-discount-percent {
    font-size: 12px;
}

.crp-badge-discount-amount {
    font-size: 10px;
}

/* Shop/Arhīva lapai - badge apakšā labajā stūrī */
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce ul.products li.product .product-image-link,
.kt-product-item .product-image-link {
    position: relative;
}

.woocommerce ul.products li.product .crp-discount-badge,
li.product .crp-discount-badge {
    bottom: 10px;
    right: 10px;
    top: auto;
    left: auto;
}

/* Single product lapai - badge uz galvenās bildes */
/* WPC Badge Management stilu pieeja - wrapper un badges struktūra */
.crp-badge-wrapper {
    position: relative;
    max-width: 100%;
}

.crp-badge-wrapper-single-image {
    display: none;
}

.woocommerce-product-gallery .crp-badge-wrapper-single-image {
    display: block !important;
}

.crp-badges {
    position: absolute;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    z-index: 9;
}

/* Badge pozīcija - labajā augšējā stūrī (kā WPC top-right) */
.crp-badges-top-right {
    top: 10px;
    left: auto;
    right: 10px;
}

/* Nodrošinām, ka woocommerce-product-gallery ir relatīvs */
.woocommerce-product-gallery {
    position: relative !important;
}

.woocommerce-product-gallery__wrapper {
    position: relative !important;
}

/* Badge uz galvenās bildes augšā labajā stūrī - izmantojot wrapper struktūru */
/* Wrapper ir absolūts, lai badge būtu uz bildes */
.woocommerce-product-gallery .crp-badge-wrapper,
.single-product .woocommerce-product-gallery .crp-badge-wrapper,
body.kadence .woocommerce-product-gallery .crp-badge-wrapper {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 9 !important;
}

.woocommerce-product-gallery .crp-badges-top-right {
    top: 10px !important;
    left: auto !important;
    right: 10px !important;
    bottom: auto !important;
}

.woocommerce-product-gallery .crp-badges-top-right .crp-discount-badge {
    position: relative !important;
    margin: 0 !important;
    pointer-events: auto !important;
}

.single-product .crp-badge-text {
    font-size: 14px;
}

.single-product .crp-badge-discount-percent {
    font-size: 12px;
}

.single-product .crp-badge-discount-amount {
    font-size: 10px;
}

/* Badge NEDRĪKST būt pie cenas - tikai uz bildes */
.crp-discount-badge.crp-badge-inline,
.price .crp-discount-badge,
.entry-summary .crp-discount-badge,
.summary .crp-discount-badge {
    display: none !important;
}

/* Poga "Turpināt ar Lietotājvārdu un paroli" */
.crp-username-login-button {
    display: inline-block !important;
    padding: 12px 20px !important;
    background: #fff !important;
    color: #333 !important;
    border: 2px solid #ddd !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

.crp-username-login-button:hover {
    background: #f5f5f5 !important;
    border-color: #0073aa !important;
    color: #0073aa !important;
}

/* Responsive */
@media (max-width: 768px) {
    .woocommerce ul.products li.product .crp-discount-badge {
        bottom: 5px;
        right: 5px;
        padding: 8px 12px;
    }
    
    .woocommerce ul.products li.product .crp-badge-text {
        font-size: 12px;
    }
    
    .woocommerce ul.products li.product .crp-badge-discount-percent {
        font-size: 10px;
    }
    
    .woocommerce ul.products li.product .crp-badge-discount-amount {
        font-size: 8px;
    }
    
    .single-product .woocommerce-product-gallery__image .crp-discount-badge {
        top: 10px !important;
        left: auto !important;
        right: 5px !important;
        padding: 8px 12px;
    }
    
    .single-product .woocommerce-product-gallery__image .crp-badge-text {
        font-size: 12px;
    }
    
    .single-product .woocommerce-product-gallery__image .crp-badge-discount-percent {
        font-size: 10px;
    }
    
    .single-product .woocommerce-product-gallery__image .crp-badge-discount-amount {
        font-size: 8px;
    }
}


