/* 
    VinVic Side Cart Pro - Premium Design (Integrated in VinVic Pro)
*/

:root {
    --vvscp-overlay-bg: rgba(0,0,0,0.5);
    --vvscp-transition: 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --vvscp-shadow: 0 10px 30px rgba(0,0,0,0.15);
    --vvscp-border: rgba(0,0,0,0.05);
    --vvscp-muted: #64748b;
    --vvscp-bottom-bg: #fbfbfb;
    --vvscp-bundle-bg: #fafafa;
    --vvscp-qty-wrap-bg: #ffffff;
    --vvscp-qty-wrap-bd: #dddddd;
    --vvscp-qty-btn-bg: #ffffff;
    --vvscp-qty-btn-txt: #111827;
    --vvscp-qty-num-txt: #111827;
    --vvscp-coupon-field-bg: #ffffff;
    --vvscp-coupon-toggle: #666666;
    /* Spójna z Centrum e-commerce (vvscp_settings → filtr vinvic_commerce_font_stack) */
    --vvscp-ui-font: var(--vv-ui-font, ui-sans-serif, system-ui, -apple-system, sans-serif);
}

#vvscp-cart-trigger,
#vvscp-cart-overlay,
.vvscp-cart-box {
    font-family: var(--vvscp-ui-font) !important;
}

/* Floating Trigger Icon */
#vvscp-cart-trigger {
    position: fixed;
    bottom: 12px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: var(--vvscp-btn-bg, #1a1a1a);
    color: var(--vvscp-btn-text, #ffffff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--vvscp-shadow);
    z-index: 99990;
    transition: var(--vvscp-transition);
}

#vvscp-cart-trigger:hover {
    transform: scale(1.1);
}

#vvscp-cart-count-bubble {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay & Drawer */
#vvscp-cart-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--vvscp-overlay-bg);
    z-index: 2147483640;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--vvscp-transition);
}

#vvscp-cart-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Szuflada poza ekranem nie powinna przechwytywać kliknięć na stronie koszyka (np. „Przejdź do kasy”). */
.vvscp-cart-box:not(.show) {
    pointer-events: none;
}

.vvscp-cart-box {
    position: fixed;
    top: 0;
    right: -410px;
    width: 390px;
    height: 100%;
    background: var(--vvscp-bg, #ffffff);
    z-index: 2147483645;
    box-shadow: var(--vvscp-shadow);
    transition: var(--vvscp-transition);
    display: flex;
    flex-direction: column;
}

.vvscp-cart-box.show {
    right: 0;
    pointer-events: auto;
}

/* Header */
.vvscp-cart-header {
    padding: 16px 20px;
    background: var(--vvscp-header-bg, #1a1a1a);
    color: var(--vvscp-header-text, #ffffff);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 1px;
}

#vvscp-cart-close {
    cursor: pointer;
    font-size: 30px;
    line-height: 1;
}

/* Dynamic Content */
#vvscp-cart-dynamic-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Info & Progress Bar */
.vvscp-top-info {
    padding: 10px 18px 2px;
    font-size: 10px;
    color: var(--vvscp-muted, #888);
    text-transform: uppercase;
}

.vvscp-ship-bar-wrap {
    padding: 8px 18px 12px;
}

.vvscp-ship-info {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--vvscp-item-text, #333333);
}

.vvscp-ship-info strong,
.vvscp-ship-info .woocommerce-Price-amount,
.vvscp-ship-info .woocommerce-Price-amount bdi,
.vvscp-ship-info .woocommerce-Price-currencySymbol {
    color: var(--vvscp-ship-price, var(--vvscp-price, var(--vvscp-prog-fill, #2ecc71))) !important;
    -webkit-text-fill-color: var(--vvscp-ship-price, var(--vvscp-price, var(--vvscp-prog-fill, #2ecc71))) !important;
    font-weight: 800;
}

.vvscp-progress {
    height: 6px;
    background: var(--vvscp-prog-bg, #e0e0e0);
    border-radius: 10px;
    overflow: hidden;
}

.vvscp-bar {
    height: 100%;
    background: var(--vvscp-prog-fill, #2ecc71);
    /* Krócej, żeby pasek „nie przeskakiwał” dramatycznie przy każdym odświeżeniu bloku. */
    transition: width 0.28s ease;
}

/* Item List */
.vvscp-items-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-anchor: none;
    padding: 8px 18px;
}

.vvscp-items-scroll::-webkit-scrollbar { width: 5px; }
.vvscp-items-scroll::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--vvscp-item-text, #334155) 22%, transparent);
    border-radius: 10px;
}

.vvscp-cart-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--vvscp-border);
}

.vvscp-row-img img {
    width: 68px;
    height: auto;
    border-radius: 6px;
}

.vvscp-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.vvscp-row-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.vvscp-row-title {
    font-weight: 600;
    color: var(--vvscp-item-text, #333333);
    text-decoration: none;
    font-size: 14px;
}

.vvscp-remove-item {
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

/* × (stare) lub przycisk z ikoną kosza */
span.vvscp-remove-item {
    font-size: 20px;
    line-height: 1;
}

button.vvscp-remove-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    padding: 0;
    border: 1px solid var(--vvscp-qty-wrap-bd, rgba(15, 23, 42, 0.14));
    border-radius: 50%;
    background: var(--vvscp-qty-btn-bg, #fff);
    color: var(--vvscp-muted, #64748b);
    font: inherit;
    line-height: 0;
    font-size: 0;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--vvscp-item-text, #0f172a) 6%, transparent);
}

button.vvscp-remove-item .vv-vinvic-trash-ico {
    width: 20px;
    height: 20px;
}

button.vvscp-remove-item.vv-vinvic-line-remove-icon {
    color: var(--vvscp-muted, #64748b);
}

.vvscp-remove-item:hover { color: #ef4444; }
button.vvscp-remove-item:hover {
    border-color: rgba(239, 68, 68, 0.35);
    background: color-mix(in srgb, #ef4444 12%, var(--vvscp-qty-btn-bg, #fff));
}

.vvscp-stock-status {
    font-size: 11px;
    font-weight: bold;
    margin: 4px 0;
}

.vvscp-stock-status.instock { color: #2ecc71; }
.vvscp-stock-status.on-backorder { color: #f1c40f; }
.vvscp-stock-status.out-of-stock { color: #e74c3c; }

/* Jedna linia: metka + stan + +/- + cena; przy braku miejsca cena pod spodem w prawo */
.vvscp-row-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 6px;
    width: 100%;
    min-width: 0;
}

.vvscp-metrics-lead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    flex: 1 1 0;
    min-width: 0;
}

.vvscp-metrics-badge {
    flex-shrink: 0;
}

.vvscp-row-metrics .vvscp-stock-status {
    margin: 0;
    flex: 1 1 6rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vvscp-row-metrics .vvscp-qty-ctrl {
    margin-top: 0;
    flex-shrink: 0;
}

.vvscp-row-price {
    font-weight: 700;
    color: var(--vvscp-price, #e67e22);
    margin: 5px 0;
    width: 100%;
    text-align: right;
}

.vvscp-row-metrics .vvscp-row-price {
    margin: 0;
    width: auto;
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

/* Pełny HTML ceny (promocja: del/ins) — nie obcinaj w wąskiej szufladzie */
.vvscp-row-metrics .vvscp-row-price--html {
    white-space: normal !important;
    max-width: min(100%, 11.5rem);
    line-height: 1.25;
}

.vvscp-row-metrics .vvscp-row-price--html .price {
    display: inline-block;
    text-align: right;
}

.vvscp-row-metrics .vvscp-row-price--html del {
    opacity: 0.65;
    font-weight: 600;
    font-size: 0.86em;
}

.vvscp-row-metrics .vvscp-row-price--html ins {
    text-decoration: none;
    font-weight: 800;
}

.vvscp-row-metrics .vvscp-row-price--html .woocommerce-Price-amount,
.vvscp-row-metrics .vvscp-row-price--html .woocommerce-Price-amount bdi,
.vvscp-row-metrics .vvscp-row-price--html .woocommerce-Price-currencySymbol {
    color: var(--vvscp-price, #e67e22) !important;
    -webkit-text-fill-color: var(--vvscp-price, #e67e22) !important;
}

.vvscp-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    background: var(--vvscp-qty-wrap-bg, #fff);
    border: 1px solid var(--vvscp-qty-wrap-bd, #ddd);
    border-radius: 999px;
    padding: 4px 8px;
}

.vvscp-qty-act {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border: 1px solid var(--vvscp-qty-wrap-bd, #ddd);
    background: var(--vvscp-qty-btn-bg, #fff);
    color: var(--vvscp-qty-btn-txt, #111827);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
}

.vvscp-qty-ctrl input {
    min-width: 2.5rem;
    max-width: 4rem;
    width: 2.75rem;
    text-align: center;
    border: 1px solid var(--vvscp-qty-wrap-bd, rgba(0, 0, 0, 0.08));
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    background: var(--vvscp-qty-wrap-bg, #fafafa);
    color: var(--vvscp-qty-num-txt, #111827);
    -webkit-text-fill-color: var(--vvscp-qty-num-txt, #111827);
}

/* Bottom Actions */
.vvscp-cart-bottom {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
    background: var(--vvscp-bottom-bg, #fbfbfb);
    border-top: 1px solid var(--vvscp-border);
    color: var(--vvscp-item-text, #334155);
}

/* Kupon: lista pod tekstem „MAM KOD RABATOWY ▼”; pole kodu zaraz pod spodem */
.vvscp-coupon-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
    margin-bottom: 12px;
    position: relative;
}

#vvscp-coupon-toggle {
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 5px;
    color: var(--vvscp-coupon-toggle, var(--vvscp-muted, #666));
}

#vvscp-coupon-input-wrap {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#vvscp-coupon-field {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--vvscp-qty-wrap-bd, #ddd);
    border-radius: 4px;
    background: var(--vvscp-coupon-field-bg, #fff);
    color: var(--vvscp-item-text, #334155);
    -webkit-text-fill-color: var(--vvscp-item-text, #334155);
}

#vvscp-coupon-btn {
    padding: 8px 15px;
    background: var(--vvscp-btn-bg, #333);
    color: var(--vvscp-btn-text, #fff);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Rozwijane podsumowanie cen (jak MAM KOD — domyślnie zwinięte) */
.vvscp-pricing-bundle {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    margin-bottom: 12px;
}

.vvscp-pricing-bundle-toggle {
    display: block;
    width: 100%;
    margin: 0 0 4px 0;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--vvscp-coupon-toggle, var(--vvscp-muted, #666));
    letter-spacing: 0.02em;
    -webkit-tap-highlight-color: transparent;
}

.vvscp-pricing-bundle-body {
    margin-top: 6px;
    padding: 10px 10px 8px;
    border-radius: 8px;
    background: var(--vvscp-bundle-bg, #fafafa);
    border: 1px solid var(--vvscp-border);
    font-size: 12px;
    line-height: 1.35;
    color: var(--vvscp-item-text, #374151);
}

.vvscp-pricing-bundle-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--vvscp-item-text, #374151);
}

.vvscp-pricing-bundle-row:last-child {
    margin-bottom: 0;
}

.vvscp-pricing-bundle-label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.vvscp-pricing-bundle-value {
    flex: 0 0 auto;
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
}

.vvscp-pricing-bundle-row--combined {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--vvscp-border);
    font-weight: 700;
}

.vvscp-pricing-bundle-row--combined .vvscp-pricing-bundle-label,
.vvscp-pricing-bundle-row--combined .vvscp-pricing-bundle-value {
    color: #15803d;
}

.vvscp-pricing-bundle-row--promo .vvscp-pricing-bundle-value {
    color: #15803d;
}

.vvscp-total-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 18px;
    width: 100%;
    gap: 12px;
    color: var(--vvscp-item-text, #334155);
}

.vvscp-total-line-label {
    align-self: center;
    color: var(--vvscp-item-text, #334155);
}

.vvscp-total-line-right {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px 14px;
    margin-left: auto;
    text-align: right;
}

.vvscp-total-line--with-savings .vvscp-total-line-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.vvscp-product-totals-compare {
    width: 100%;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-align: right;
}

.vvscp-cart-bottom .vv-sale-price-split {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px 12px;
}

.vvscp-cart-bottom .vv-sale-price-split__regular,
.vvscp-cart-bottom .vv-sale-price-split__regular .woocommerce-Price-amount {
    opacity: 0.65;
    color: #6b7280 !important;
    font-weight: 600;
}

.vvscp-savings-cluster {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    color: #15803d;
}

.vvscp-savings-cluster__label {
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.92;
}

.vvscp-savings-cluster__amount {
    font-weight: 800;
    white-space: nowrap;
}

.vvscp-savings-cluster__amount .woocommerce-Price-amount {
    color: inherit;
}

.vvscp-savings-cluster__qual {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(21, 128, 61, 0.9);
}

.vvscp-price-big {
    color: var(--vvscp-price, #e67e22);
    font-size: 22px;
    text-align: right;
    margin-left: 0;
}

.vvscp-price-big .woocommerce-Price-amount,
.vvscp-price-big .woocommerce-Price-amount bdi,
.vvscp-price-big .woocommerce-Price-currencySymbol {
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
}

.vvscp-pricing-bundle-value .woocommerce-Price-amount,
.vvscp-pricing-bundle-value .woocommerce-Price-amount bdi,
.vvscp-pricing-bundle-value .woocommerce-Price-currencySymbol {
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
}

.vvscp-tax-info {
    text-align: right;
    font-size: 11px;
    color: var(--vvscp-muted, #888);
    margin-top: -15px;
    margin-bottom: 15px;
    font-weight: 600;
}

#vvscp-order-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--vvscp-btn-bg, #1a1a1a);
    color: var(--vvscp-btn-text, #ffffff);
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 10px;
    transition: 0.3s;
}

#vvscp-order-btn:hover {
    opacity: 0.9;
}

#vvscp-keep-shopping {
    display: block;
    width: auto;
    max-width: 100%;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
    padding: 14px 18px;
    background: transparent;
    border: 1px solid var(--vvscp-qty-wrap-bd, #ddd);
    color: var(--vvscp-muted, #888);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Animations */
@keyframes vvscpSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.vvscp-cart-row {
    animation: vvscpSlideIn 0.3s ease forwards;
}

.vvscp-empty-msg {
    text-align: center;
    padding: 40px;
    color: var(--vvscp-muted, #999);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .vvscp-cart-box { width: 100%; right: -100%; }
}

/* Sales funnel + shared quantity controls (side cart/cart/checkout) */
.vvscp-funnel {
    margin: 8px 0 12px;
    padding: 10px;
    border: 1px solid var(--vvscp-border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.02);
}

.vvscp-funnel-steps {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.vvscp-funnel-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
}

.vvscp-funnel-step.is-active {
    opacity: 1;
}

.vvscp-funnel-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--vvscp-btn-bg, #111827);
    color: var(--vvscp-btn-text, #fff);
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vvscp-funnel-cart-lines {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.vvscp-funnel-cart-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.vvscp-funnel-cart-line-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--vvscp-item-text, #334155);
}

/* Wspólny wariant paska z vv-commerce-ui-harmony (klasa .vv-vinvic-qty) */
.vv-vinvic-line-qty-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.vv-vinvic-line-qty-group--read-only {
    align-items: center;
    gap: 8px;
}

.vvscp-funnel-qty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    padding: 4px 8px;
    background: #fff;
}

.vvscp-funnel-qty-btn {
    border: none;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    background: var(--vvscp-btn-bg, #111827);
    color: var(--vvscp-btn-text, #fff);
}

.vvscp-funnel-qty input {
    min-width: 2.25rem;
    max-width: 3.5rem;
    width: 2.5rem;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 700;
    padding: 0;
}

.vvscp-funnel-qty--inline {
    vertical-align: middle;
}

.vvscp-funnel-qty--subtle {
    gap: 6px;
    padding: 2px 6px;
    border-color: rgba(148, 163, 184, 0.45);
    background: #f8fafc;
    width: fit-content;
}

.vvscp-funnel-qty--subtle .vvscp-funnel-qty-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
    background: #e2e8f0;
    color: #334155;
}

.vvscp-funnel-qty--subtle input {
    min-width: 1.75rem;
    max-width: 3rem;
    width: 2rem;
    font-size: 12px;
    color: #0f172a;
}

.vvscp-qty-hint {
    display: block;
    margin-top: 4px;
    font-size: 9px;
    line-height: 1.25;
    font-weight: 600;
    color: #dc2626;
}

/* Ładowanie na katalogu/produkcie: zasłona + spinner na body (vv-frontend.css), tu tylko izolacja szuflady. */
body.vv-wc-prices-loading:not(.woocommerce-cart):not(.woocommerce-checkout):not(.vv-vinvic-cart-embed) .vvscp-cart-box {
    isolation: isolate;
}
