/**
 * Vige Upsells — storefront base styles.
 *
 * Variables come from <style id="vige-upsells-tokens"> emitted by
 * TokenRenderer. Per-instance Elementor overrides cascade via {{WRAPPER}}.
 */

.vige-upsell-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.vige-upsell-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: var(--vige-checkbox-size, 22px);
    height: var(--vige-checkbox-size, 22px);
    border-radius: var(--vige-checkbox-radius, 5px);
    background: var(--vige-surface-light, #fff);
    border: 1.5px solid var(--vige-border, #d4d4d8);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out;
    margin: 0;
    position: relative;
}

.vige-upsell-checkbox:checked {
    background: var(--vige-checkbox-fill, var(--vige-surface-dark, #18181b));
    border-color: var(--vige-checkbox-fill, var(--vige-surface-dark, #18181b));
}

.vige-upsell-checkbox:checked::after {
    content: '';
    width: 55%;
    height: 30%;
    border-left: 2px solid var(--vige-checkbox-check, #fff);
    border-bottom: 2px solid var(--vige-checkbox-check, #fff);
    transform: rotate(-45deg) translate(10%, -10%);
}

.vige-upsell-checkbox:hover {
    transform: scale(1.05);
}

.vige-sale-price-wrap {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    font-family: var(--vige-font-body, inherit);
}

.vige-old-price {
    color: var(--vige-text-muted, #a1a1aa);
    font-size: 0.85em;
}

.vige-new-price {
    color: var(--vige-text, #18181b);
    font-weight: 700;
}

.vige-savings-badge {
    display: inline-block;
    background: var(--vige-accent, #ef4444);
    color: #fff;
    font-size: var(--vige-text-xs, 11px);
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.vige-qty-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--vige-border, #d4d4d8);
    border-radius: 8px;
    background: var(--vige-surface-light, #fff);
    overflow: hidden;
}

.vige-qty-selector button {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: var(--vige-text-muted, #71717a);
}

.vige-qty-input {
    width: 40px;
    height: 32px;
    border: 0;
    text-align: center;
    font-weight: 600;
    background: transparent;
    -moz-appearance: textfield;
}

.vige-qty-input::-webkit-outer-spin-button,
.vige-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.vige-variation-picker {
    background: var(--vige-surface-light, #fff);
    border: 1px solid var(--vige-border, #d4d4d8);
    border-radius: 8px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: var(--vige-text-sm, 13px);
}

.vige-bundle-summary {
    background: var(--vige-surface-dark, #18181b);
    color: #fff;
    border-radius: var(--vige-card-radius, 12px);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-family: var(--vige-font-body, inherit);
    transition: opacity 0.15s ease-out;
}

.vige-bundle-summary.is-loading {
    opacity: 0.7;
}

.vige-bundle-summary .vige-bundle-meta {
    font-size: var(--vige-text-xs, 11px);
    color: var(--vige-text-muted, #a1a1aa);
    margin-bottom: 4px;
}

.vige-bundle-summary .vige-bundle-total {
    font-size: var(--vige-text-xl, 22px);
    font-weight: 700;
    color: #fff;
}

.vige-bundle-summary .vige-bundle-saved {
    font-size: var(--vige-text-xs, 11px);
    background: var(--vige-success, #22c55e);
    color: #052e16;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 8px;
}

.vige-bundle-button {
    background: linear-gradient(135deg, var(--vige-primary, #f97316), var(--vige-accent, #ef4444));
    color: #fff;
    border: 0;
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: var(--vige-text-sm, 13px);
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px -8px rgba(249, 115, 22, 0.6);
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.vige-bundle-button:hover:not([disabled]) {
    transform: translateY(-1px);
}

.vige-bundle-button.is-muted,
.vige-bundle-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.vige-bundle-button.is-busy {
    pointer-events: none;
    opacity: 0.7;
}

.vige-cart-bundle-pill {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.1);
    color: var(--vige-primary, #c2410c);
}

.vige-cart-bundle-pill[data-role="primary"] {
    background: rgba(24, 24, 27, 0.08);
    color: var(--vige-text, #18181b);
}

.vige-bundle-savings th,
.vige-bundle-savings td {
    color: var(--vige-success, #16a34a);
    font-weight: 600;
}

/* ============ Full drop-in widget (UpsellsWidget) ============ */
/* All layout rules use !important + .vige-upsells-widget descendant selectors */
/* to beat WC/Astra/Hello/JetEngine theme styles that target broad img/li/* rules */

.vige-upsells-widget {
    background: var(--vige-surface-light, #fff) !important;
    border: 1px solid var(--vige-border, #e4e4e7) !important;
    border-radius: var(--vige-card-radius, 14px) !important;
    padding: var(--vige-card-padding, 18px) !important;
    color: var(--vige-text, #18181b);
    max-width: var(--vige-container-max, 760px);
    margin: 16px 0 !important;
    box-sizing: border-box !important;
}

.vige-upsells-widget * {
    box-sizing: border-box !important;
}

.vige-upsells-widget .vige-upsells-title {
    font-size: var(--vige-text-lg, 18px) !important;
    font-weight: 700 !important;
    margin: 0 0 14px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: var(--vige-text, #18181b) !important;
    line-height: 1.2 !important;
}

.vige-upsells-widget .vige-upsells-title::before {
    content: '' !important;
    display: inline-block !important;
    width: 4px !important;
    height: 18px !important;
    background: linear-gradient(180deg, var(--vige-primary, #f97316), var(--vige-accent, #ef4444)) !important;
    border-radius: 2px !important;
    flex-shrink: 0 !important;
}

/* Items list — reset themes' ul/li styles */
.vige-upsells-widget ul.vige-upsells-items,
.vige-upsells-widget .vige-upsells-items {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    padding: 0 !important;
    margin: 0 0 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--vige-item-gap, 10px) !important;
    background: transparent !important;
}

.vige-upsells-widget .vige-upsells-items > li,
.vige-upsells-widget .vige-upsells-item {
    list-style: none !important;
    list-style-type: none !important;
    background-image: none !important;
    margin: 0 !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: 28px 64px minmax(0, 1fr) auto !important;
    column-gap: 12px !important;
    row-gap: 4px !important;
    align-items: center !important;
    background: rgba(0, 0, 0, 0.025) !important;
    border: 1px solid var(--vige-border, #e4e4e7) !important;
    border-radius: 10px !important;
    text-indent: 0 !important;
    line-height: 1.4 !important;
}

/* Kill any ::before/::marker bullets injected by themes */
.vige-upsells-widget .vige-upsells-items > li::before,
.vige-upsells-widget .vige-upsells-items > li::marker {
    content: none !important;
    display: none !important;
    background: none !important;
}

.vige-upsells-widget .vige-upsells-item:has(.vige-upsell-checkbox:checked) {
    border-color: var(--vige-primary, #f97316) !important;
    background: rgba(249, 115, 22, 0.06) !important;
}

.vige-upsells-widget .vige-upsells-item-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
}

.vige-upsells-widget .vige-upsells-item-img {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    min-width: 64px !important;
    max-height: 64px !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    background: var(--vige-border, #e4e4e7) !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.vige-upsells-widget .vige-upsells-item-img--placeholder {
    background: linear-gradient(160deg, #1f2937, #374151) !important;
}

.vige-upsells-widget .vige-upsells-item-meta {
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.vige-upsells-widget .vige-upsells-item-name {
    font-size: var(--vige-text-sm, 13px) !important;
    font-weight: 600 !important;
    color: var(--vige-text, #18181b) !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vige-upsells-widget .vige-upsells-item-variation {
    margin: 4px 0 0 !important;
    background: var(--vige-surface-light, #fff) !important;
    border: 1px solid var(--vige-border, #d4d4d8) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    font-size: var(--vige-text-xs, 11px) !important;
    max-width: 220px;
}

.vige-upsells-widget .vige-upsells-item-price {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 2px !important;
    font-size: var(--vige-text-sm, 13px) !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
}

.vige-upsells-widget .vige-upsells-item-price .vige-sale-price-wrap {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 1px !important;
    line-height: 1.2 !important;
}

.vige-upsells-widget .vige-upsells-item-price .vige-old-price {
    font-size: var(--vige-text-xs, 11px) !important;
    color: var(--vige-text-muted, #a1a1aa) !important;
    text-decoration: line-through;
}
.vige-upsells-widget .vige-upsells-item-price .vige-new-price {
    font-weight: 700 !important;
    color: var(--vige-text, #18181b) !important;
}

/* ===== Summary bar — clean RTL-safe two-column layout ===== */
.vige-upsells-widget .vige-bundle-summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    column-gap: 16px !important;
    align-items: center !important;
    padding: 14px 18px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    line-height: 1.3 !important;
}

.vige-upsells-widget .vige-bundle-summary-meta {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    align-items: flex-start !important;
    font-size: var(--vige-text-xs, 11px) !important;
    color: var(--vige-text-muted, #a1a1aa) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.vige-upsells-widget .vige-bundle-summary-meta-line {
    display: inline-flex !important;
    align-items: baseline !important;
    gap: 6px !important;
}

.vige-upsells-widget .vige-bundle-total {
    font-size: var(--vige-text-xl, 22px) !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: inherit !important;
}

.vige-upsells-widget .vige-bundle-saved-pill {
    font-size: var(--vige-text-xs, 11px) !important;
    color: var(--vige-success, #22c55e) !important;
    font-weight: 600 !important;
    background: rgba(34, 197, 94, 0.15) !important;
    padding: 2px 8px !important;
    border-radius: 999px !important;
}

.vige-upsells-widget .vige-bundle-summary-cta {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

.vige-upsells-placeholder {
    background: rgba(249, 115, 22, 0.08);
    border: 1px dashed rgba(249, 115, 22, 0.4);
    color: var(--vige-text-muted, #71717a);
    border-radius: 10px;
    padding: 16px;
    font-size: var(--vige-text-sm, 13px);
}

.vige-upsells-placeholder {
    background: rgba(249, 115, 22, 0.08);
    border: 1px dashed rgba(249, 115, 22, 0.4);
    color: var(--vige-text-muted, #71717a);
    border-radius: 10px;
    padding: 16px;
    font-size: var(--vige-text-sm, 13px);
}

/* RTL */
html[dir="rtl"] .vige-upsell-checkbox:checked::after {
    transform: rotate(-45deg) translate(10%, -10%);
}

html[dir="rtl"] .vige-bundle-summary .vige-bundle-saved {
    margin-left: 0;
    margin-right: 8px;
}

html[dir="rtl"] .vige-upsells-item {
    grid-template-columns: 28px 64px 1fr auto;
}

html[dir="rtl"] .vige-upsells-item-price {
    text-align: right;
    align-items: flex-start;
}

html[dir="rtl"] .vige-upsells-item-price .vige-sale-price-wrap {
    align-items: flex-start;
}

html[dir="rtl"] .vige-bundle-saved-pill {
    margin-left: 0;
    margin-right: auto;
}

/* Responsive */
@media (max-width: 560px) {
    .vige-upsells-item {
        grid-template-columns: 24px 56px 1fr;
        grid-template-areas:
            "chk img name"
            "chk img price";
    }
    .vige-upsells-item-toggle { grid-area: chk; }
    .vige-upsells-item-img    { grid-area: img; width: 56px; height: 56px; }
    .vige-upsells-item-meta   { grid-area: name; }
    .vige-upsells-item-price  {
        grid-area: price;
        text-align: left;
        align-items: flex-start;
        flex-direction: row;
        gap: 8px;
    }
    .vige-upsells-item-price .vige-sale-price-wrap {
        flex-direction: row;
        align-items: baseline;
    }
}

/* ---------------------------------------------------------------------
 * Atomic bundle shortcodes ([vige_bundle_*]). These are inline spans the
 * user drops into Elementor to build a custom summary surface. They
 * inherit zero styling from the built-in dark/light card so the user can
 * style each piece freely inside Elementor.
 * --------------------------------------------------------------------- */
.vige-bundle-atom {
    display: inline;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    color: inherit;
    font: inherit;
}
.vige-bundle-atom .vige-bundle-button {
    /* Bring back interactive affordance even though the wrapper resets it. */
    cursor: pointer;
}
.vige-bundle-atom.is-loading {
    opacity: 0.7;
}

/* ---------------------------------------------------------------------
 * Bundle-removal confirmation modal — shown when the customer clicks the
 * × on a bundled cart line.
 *
 * Colors come from --vige-* tokens (emitted by TokenRenderer) so the modal
 * picks up the shop's brand palette automatically. Fallbacks are the same
 * neutral defaults the rest of the plugin uses.
 *
 * Direction-agnostic — works in the Hebrew RTL storefront and any LTR
 * preview. Buttons live in flex order so the visual order in RTL is
 * Cancel-right / Confirm-left, which is the established Hebrew convention.
 * --------------------------------------------------------------------- */
.vige-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-family: var(--vige-font-body, inherit);
}
.vige-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 24, 27, 0.55);
}
.vige-modal__dialog {
    position: relative;
    background: var(--vige-surface-light, #fff);
    color: var(--vige-text, #18181b);
    border: 1px solid var(--vige-border, #e4e4e7);
    border-radius: 14px;
    padding: 22px 24px 18px;
    width: min(440px, calc(100vw - 32px));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    max-height: calc(100vh - 32px);
    overflow: auto;
    /* Wide RTL/LTR safe — text honours the document direction. */
    text-align: start;
}
.vige-modal__title {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--vige-text, #18181b);
}
.vige-modal__body {
    margin: 0 0 18px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--vige-text-muted, #52525b);
}
.vige-modal__list {
    margin: 12px 0 0;
    padding: 10px 14px;
    list-style: none;
    background: var(--vige-surface-soft, color-mix(in srgb, var(--vige-surface-light, #fff) 92%, var(--vige-text, #18181b) 8%));
    border: 1px solid var(--vige-border, #e4e4e7);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--vige-text, #18181b);
}
.vige-modal__list li {
    padding: 4px 0;
    border-bottom: 1px dashed var(--vige-border, #e4e4e7);
}
.vige-modal__list li:last-child {
    border-bottom: 0;
}
.vige-modal__list li::before {
    content: "•";
    color: var(--vige-primary, #f97316);
    font-weight: 700;
    margin-inline-end: 8px;
}
.vige-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.vige-modal__btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    min-width: 110px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease-out;
}
.vige-modal__btn:active {
    transform: translateY(1px);
}
.vige-modal__btn--cancel {
    background: transparent;
    color: var(--vige-text, #18181b);
    border-color: var(--vige-border, #d4d4d8);
}
.vige-modal__btn--cancel:hover {
    background: var(--vige-border, #e4e4e7);
}
.vige-modal__btn--confirm {
    background: var(--vige-surface-dark, #18181b);
    color: var(--vige-surface-light, #fff);
    border-color: var(--vige-surface-dark, #18181b);
}
.vige-modal__btn--confirm:hover {
    filter: brightness(1.1);
}
.vige-modal__btn--confirm.vige-modal__btn--destructive {
    background: var(--vige-accent, #ef4444);
    border-color: var(--vige-accent, #ef4444);
    color: #fff;
}
.vige-modal__btn--confirm.vige-modal__btn--destructive:hover {
    filter: brightness(1.07);
}
.vige-modal__btn:focus-visible {
    outline: 2px solid var(--vige-primary, #f97316);
    outline-offset: 2px;
}
