/* ==========================================================================
   BonusPlus Loyalty System - Bonus Badges, Balance Widget & Tooltips
   Light / Dark Themes with Modal Form Aesthetics
   ========================================================================== */

/* Balance Widget */
.bp-balance-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--bp-radius-card, 12px);
    background-color: var(--bp-bg-card, #ffffff);
    border: 1px solid var(--bp-border-card, #e2e8f0);
    box-shadow: var(--bp-shadow-card);
    color: var(--bp-text-primary, #1e293b);
    box-sizing: border-box;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

:root[data-bp-theme="dark"] .bp-balance-card,
[data-bp-theme="dark"] .bp-balance-card,
.bp-balance-card.bp-theme-dark {
    background-color: #252830;
    color: #f3f4f6;
    border-color: #383c48;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

:root[data-bp-theme="dark"] .bp-balance-card-label,
[data-bp-theme="dark"] .bp-balance-card-label,
.bp-balance-card.bp-theme-dark .bp-balance-card-label {
    color: #a1a7b5;
}

:root[data-bp-theme="light"] .bp-balance-card,
[data-bp-theme="light"] .bp-balance-card,
.bp-balance-card.bp-theme-light {
    background-color: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
}

:root[data-bp-theme="light"] .bp-balance-card-label,
[data-bp-theme="light"] .bp-balance-card-label,
.bp-balance-card.bp-theme-light .bp-balance-card-label {
    color: #64748b;
}

.bp-balance-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--infopush-bonusplus-site-color, #007bff) 14%, transparent);
    color: var(--infopush-bonusplus-site-color, #007bff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bp-balance-card-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.bp-balance-card-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--bp-text-secondary, #64748b);
    line-height: 1.2;
}

.bp-balance-card-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--infopush-bonusplus-site-color, #007bff);
    line-height: 1.2;
}

/* Product Catalog / Basket Badges */
.bonusplus-display-price {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

/* Green Credit Badges (+X бонусов / Начислится) */
.bp-bonus-container,
.bp-credit-container,
.bp-bonus-badge,
.bonus-conteiner,
.credit-conteiner,
.bonus-container,
.credit-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
    color: #15803d;
    background-color: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.35);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Red Debit Badges (-X бонусов / Спишется) */
.bp-debit-container,
.bp-debit-badge,
.debit-conteiner,
.debit-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
    color: #dc2626;
    background-color: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Dark Theme Badge Colors */
:root[data-bp-theme="dark"] .bp-bonus-container,
:root[data-bp-theme="dark"] .bp-credit-container,
:root[data-bp-theme="dark"] .bonus-conteiner,
:root[data-bp-theme="dark"] .credit-conteiner,
:root[data-bp-theme="dark"] .bonus-container,
:root[data-bp-theme="dark"] .credit-container,
[data-bp-theme="dark"] .bp-bonus-container,
[data-bp-theme="dark"] .bp-credit-container,
[data-bp-theme="dark"] .bonus-conteiner,
[data-bp-theme="dark"] .credit-conteiner,
[data-bp-theme="dark"] .bonus-container,
[data-bp-theme="dark"] .credit-container,
.bp-theme-dark .bp-bonus-container,
.bp-theme-dark .bp-credit-container,
.bp-theme-dark .bonus-conteiner,
.bp-theme-dark .credit-conteiner,
.bp-theme-dark .bonus-container,
.bp-theme-dark .credit-container {
    color: #4ade80;
    background-color: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.45);
}

:root[data-bp-theme="dark"] .bp-debit-container,
:root[data-bp-theme="dark"] .debit-conteiner,
:root[data-bp-theme="dark"] .debit-container,
[data-bp-theme="dark"] .bp-debit-container,
[data-bp-theme="dark"] .debit-conteiner,
[data-bp-theme="dark"] .debit-container,
.bp-theme-dark .bp-debit-container,
.bp-theme-dark .debit-conteiner,
.bp-theme-dark .debit-container {
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.45);
}

/* Container for badges in cart item */
.bonusplus-item-bonuses-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    align-items: flex-end;
}

@media (max-width: 768px) {
    .bonusplus-item-bonuses-wrap {
        align-items: flex-start;
    }
}

/* Dedicated container for order total bonuses */
.bonusplus-total-bonuses-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
}

.bonus-info-block,
.bp-bonus-info-block {
    display: inline-flex;
    width: fit-content;
    margin: 0;
}

.bonusplus-total-block,
.bp-total-block {
    display: inline-flex;
    width: fit-content;
    margin: 0;
}

/* Tooltip in Cart */
.bonus-tooltip-wrapper,
.bp-tooltip-wrapper {
    display: inline-flex;
    align-items: center;
    position: relative;
    margin-left: 6px;
    cursor: help;
    z-index: 10;
}

.bonus-tooltip-text,
.bp-tooltip-text {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bp-bg-card, #ffffff);
    color: var(--bp-text-primary, #1e293b);
    border: 1px solid var(--bp-border-card, #cbd5e1);
    padding: 8px 12px;
    border-radius: var(--bp-radius-input, 8px);
    font-size: 12px;
    width: max-content;
    max-width: 280px;
    white-space: normal;
    word-wrap: break-word;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    line-height: 1.45;
    text-align: left;
    pointer-events: none;
}

:root[data-bp-theme="dark"] .bonus-tooltip-text,
:root[data-bp-theme="dark"] .bp-tooltip-text,
[data-bp-theme="dark"] .bonus-tooltip-text,
[data-bp-theme="dark"] .bp-tooltip-text,
.bp-theme-dark .bonus-tooltip-text,
.bp-theme-dark .bp-tooltip-text,
[data-theme="dark"] .bonus-tooltip-text,
[data-theme="dark"] .bp-tooltip-text {
    background: #252830;
    color: #f3f4f6;
    border: 1px solid #383c48;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Hide technical loyalty service properties in basket and checkout */
[data-property-code="MESSAGES"],
[data-property-code="DISCOUNT_PRICE_API"],
[data-property-code="DISCOUNT_PRICE_BASE"],
[data-property-code="DISCOUNT_PRICE"],
[data-property-code="DISCOUNT_PERCENT"],
[data-property-code="DISCOUNT_PRICE_API_PERCENT"],
[data-property-code="BONUS_DEBIT"],
[data-property-code="BONUS_CREDIT"],
[data-code="MESSAGES"],
[data-code="DISCOUNT_PRICE_API"],
[data-code="DISCOUNT_PRICE_BASE"],
[data-code="DISCOUNT_PRICE"],
[data-code="DISCOUNT_PERCENT"],
[data-code="DISCOUNT_PRICE_API_PERCENT"],
[data-code="BONUS_DEBIT"],
[data-code="BONUS_CREDIT"] {
    display: none;
}

/* ==========================================================================
   Widget Loader & Spinner (Balance Card & Containers)
   ========================================================================== */
.bp-balance-card {
    position: relative;
    overflow: hidden;
}

.bp-balance-card .bp-widget-loader,
.bp-widget-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background-color: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-sizing: border-box;
}

:root[data-bp-theme="dark"] .bp-widget-loader,
[data-bp-theme="dark"] .bp-widget-loader,
.bp-theme-dark .bp-widget-loader,
[data-theme="dark"] .bp-widget-loader,
.bp-balance-card.bp-theme-dark .bp-widget-loader {
    background-color: rgba(37, 40, 48, 0.82);
}

.bp-balance-card.bp-loading > .bp-widget-loader {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.bp-spinner {
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border: 2.5px solid color-mix(in srgb, var(--infopush-bonusplus-site-color, #007bff) 22%, transparent);
    border-top-color: var(--infopush-bonusplus-site-color, #007bff);
    border-radius: 50%;
    animation: bp-spinner-rot 0.65s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes bp-spinner-rot {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}