/* Koszyk Boczny - WEB33 — koszyk boczny (wartości przeniesione 1:1 z dotychczasowego kodu motywu) */
/* UKRYCIE STAREGO / DOMYŚLNEGO DROPDOWNA KOSZYKA Z NAGŁÓWKA MOTYWU */
.widget_shopping_cart, 
.woocommerce-mini-cart, 
.cart-plugin .widget_shopping_cart_content,
.nav-click-target .widget_shopping_cart {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* --- STYLIZACJA SLIDE-IN PANELU KOSZYKA --- */
#side-cart-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999998;
}
@media (max-width: 767px) {
    #side-cart-overlay.active {
        display: block;
    }
}

#side-cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    left: auto;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    z-index: 999999;
    box-shadow: -8px 0 30px rgba(0,0,0,0.18);
    transition: right 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}
#side-cart-drawer.active {
    right: 0 !important;
}

@media (max-width: 767px) {
    #side-cart-drawer {
        width: 50vw !important;
        min-width: 280px;
    }
}

.side-cart-header {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
    flex-shrink: 0;
}
.side-cart-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
}
.side-cart-close {
    background: #f1f5f9;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s ease;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
}
.side-cart-close:hover {
    color: #ffffff;
    background: #e53e3e;
}

.side-cart-shipping-bar-wrapper {
    padding: 12px 16px 5px 16px;
    background: #ffffff;
    flex-shrink: 0;
}

.side-cart-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 16px;
    -webkit-overflow-scrolling: touch;
}

.side-cart-empty {
    text-align: center;
    padding: 40px 10px;
    color: #718096;
}

.side-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}
.side-cart-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f4f8;
    position: relative;
}
.side-cart-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #edf2f7;
    margin-right: 10px;
    flex-shrink: 0;
}
.side-cart-item-details {
    flex-grow: 1;
    padding-right: 20px;
}
.side-cart-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    text-decoration: none;
    display: block;
    margin-bottom: 3px;
    line-height: 1.25;
}
.side-cart-item-title:hover {
    color: #2b6cb0;
}
.side-cart-item-price {
    font-size: 13px;
    color: #4a5568;
    font-weight: 700;
}

.side-cart-item-qty-row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 12px;
    color: #718096;
}
.side-cart-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #4a5568;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.side-cart-qty-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
    color: #1a202c;
}
.side-cart-qty-btn:active {
    background: #edf2f7;
}

.side-cart-remove-item {
    position: absolute;
    right: 0;
    top: 10px;
    color: #cbd5e0;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    transition: color 0.2s ease;
    cursor: pointer;
    padding: 0 4px;
}
.side-cart-remove-item:hover {
    color: #e53e3e;
}

/* --- POLA KODU RABATOWEGO W SIDE CART --- */
.side-cart-coupon-form {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.side-cart-coupon-input {
    flex: 1;
    padding: 7px 10px;
    font-size: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}
.side-cart-coupon-input:focus {
    border-color: #2b6cb0;
}
.side-cart-coupon-btn {
    background: #4a5568;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.side-cart-coupon-btn:hover {
    background: #2d3748;
}
.side-cart-coupon-msg {
    font-size: 11px;
    margin-bottom: 8px;
    text-align: center;
}
.side-cart-coupon-msg.success { color: #27ae60; }
.side-cart-coupon-msg.error { color: #e53e3e; }

.side-cart-discount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #27ae60;
    font-weight: 600;
    margin-bottom: 8px;
}
.side-cart-remove-coupon {
    color: #e53e3e;
    text-decoration: none;
    font-size: 11px;
    margin-left: 6px;
    cursor: pointer;
}

.side-cart-footer {
    padding: 12px 16px 20px 16px;
    border-top: 1px solid #edf2f7;
    background: #fafbfc;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.03);
    flex-shrink: 0;
    margin-top: auto;
}
.side-cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    margin-bottom: 6px;
}
.side-cart-final-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 800;
    color: #1a202c;
    margin-top: 4px;
    margin-bottom: 12px;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
}
.side-cart-checkout-btn {
    display: block !important;
    width: 100% !important;
    background: #2ecc71 !important;
    color: #ffffff !important;
    text-align: center !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3) !important;
    transition: background 0.25s ease, transform 0.15s ease !important;
    box-sizing: border-box !important;
}
.side-cart-checkout-btn:hover {
    background: #27ae60 !important;
    transform: translateY(-1px);
}

/* --- PŁYWAJĄCA IKONKA KOSZYKA (PRAWY DOLNY RÓG) --- */
#floating-side-cart-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 54px;
    height: 54px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999997;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s ease;
    user-select: none;
}
#floating-side-cart-trigger:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
#floating-side-cart-trigger svg {
    width: 24px;
    height: 24px;
    stroke: #e53e3e;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#floating-side-cart-badge {
    position: absolute;
    top: -3px;
    left: -3px;
    background: #000000;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    transition: transform 0.2s ease;
}
#floating-side-cart-trigger.drawer-active {
    transform: translateX(-420px);
}
@media (max-width: 767px) {
    #floating-side-cart-trigger {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
    }
    #floating-side-cart-trigger.drawer-active {
        transform: translateX(-50vw);
    }
}

/* ===================== Zmiany wtyczki (projekt §5.5) ===================== */

/* Pływająca ikona omija paski przy dolnej krawędzi (cookie-notice, baner PK). */
#floating-side-cart-trigger {
    bottom: calc(25px + var(--kbw-lift, 0px));
}
#floating-side-cart-trigger:focus-visible,
.side-cart-close:focus-visible {
    outline: 2px solid #2b6cb0;
    outline-offset: 2px;
}

/* Lista produktów zawsze ma miejsce. */
.side-cart-body {
    min-height: 140px;
}

/* Telefon: szerszy panel, ikona chowa się zamiast nachodzić na panel. */
@media (max-width: 767px) {
    #side-cart-drawer {
        width: min(420px, 88vw) !important;
        min-width: 0;
    }
    #floating-side-cart-trigger {
        bottom: calc(20px + var(--kbw-lift, 0px));
    }
    #floating-side-cart-trigger.drawer-active {
        transform: none;
        opacity: 0;
        pointer-events: none;
    }
}

/* Niski ekran: przewija się cała zawartość, przycisk zamówienia zostaje przyklejony na dole. */
@media (max-height: 640px) {
    #side-cart-content-target {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    #side-cart-content-target .side-cart-body {
        flex: 0 0 auto;
        overflow: visible;
    }
    #side-cart-content-target .side-cart-footer {
        margin-top: 0;
    }
    .kbw-checkout-wrap {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: inherit;
        padding: 6px 0 2px;
    }
}

/* Kupon zwijany w link (domyślnie tylko na telefonie). */
.kbw-coupon-toggle {
    display: none;
    font-size: 12px;
    margin: 0 0 10px;
    color: #4a5568;
    text-decoration: underline;
    cursor: pointer;
}
.kbw-coupon--closed:not(.is-open) .kbw-coupon-toggle {
    display: inline-block;
}
.kbw-coupon--closed:not(.is-open) .side-cart-coupon-form {
    display: none;
}
@media (max-width: 767px) {
    .kbw-coupon--mobile:not(.is-open) .kbw-coupon-toggle {
        display: inline-block;
    }
    .kbw-coupon--mobile:not(.is-open) .side-cart-coupon-form {
        display: none;
    }
}

/* Dane pozycji (np. „Gratis: w ramach oferty”, „Pakiet 2 szt.”). */
.side-cart-item-details dl.variation {
    margin: 2px 0 3px;
    font-size: 11px;
    line-height: 1.3;
    color: #718096;
}
.side-cart-item-details dl.variation dt,
.side-cart-item-details dl.variation dd,
.side-cart-item-details dl.variation dd p {
    display: inline;
    margin: 0;
    padding: 0;
}
.side-cart-item-details dl.variation dt {
    margin-right: 3px;
}
.side-cart-item-price del {
    opacity: .6;
    font-weight: 400;
    margin-right: 4px;
}
.side-cart-item-price ins {
    text-decoration: none;
}

/* Trwa akcja. */
#side-cart-drawer.kbw-busy .side-cart-content {
    opacity: .6;
    pointer-events: none;
    transition: opacity .15s ease;
}
