/* --- GŁÓWNY KONTENER KOSZYKA --- */
#customcart_block {
    position: relative;
    float: right;
    z-index: 1001;
}

.customcart_header {
    cursor: pointer;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    transition: background 0.3s ease;
}

.customcart_header:hover,
#customcart_block.is-active .customcart_header {
    background: #e0e0e0;
}

.customcart_header a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.customcart-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1.003 1.003 0 0 0 20 4H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"/></svg>') no-repeat center center;
    background-size: contain;
    margin-right: 8px;
}

.ajax_cart_quantity {
    background-color: #af2200;
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    margin-right: 8px;
}

.cart_title {
    font-size: 14px;
    font-weight: 600;
}

/* --- ROZWIJANY PANEL KOSZYKA --- */
.cart_block_list {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.cart_block_list.open {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cart_block_list_content {
    position: relative;
    max-height: 70vh;
    overflow-y: auto;
}

#customcart_block.loading .cart_block_list_content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    z-index: 2;
}
#customcart_block.loading .cart_block_list_content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f0f0f0;
    border-top-color: #af2200;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 3;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- ZAWARTOŚĆ PANELU --- */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f8f8;
}

.cart-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    font-size: 24px;
    font-weight: bold;
    color: #999;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}
.close-btn:hover {
    opacity: 1;
}

ul.cart_block_products {
    list-style: none;
    padding: 10px 20px;
    margin: 0;
}

li.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}
li.cart-item:last-child {
    border-bottom: none;
}

.cart-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    margin-right: 15px;
}
.cart-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-info {
    flex-grow: 1;
}
.product-name a {
    font-weight: 600;
    color: #333;
    text-decoration: none;
}
.product-attributes {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}
.quantity-control {
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.quantity-control .price {
    font-weight: bold;
    margin-right: 5px;
}
.quantity-control span {
    font-size: 13px;
    color: #888;
}
.quantity-control a {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 22px;
    text-align: center;
    border: 1px solid #ddd;
    color: #555;
    text-decoration: none;
    border-radius: 3px;
    margin: 0 5px;
    background: #f9f9f9;
}
.quantity-control a:hover {
    background: #f0f0f0;
}

.remove-from-cart {
    flex-shrink: 0;
    margin-left: 15px;
}
.remove-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>') no-repeat center center;
    background-size: contain;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}
.remove-from-cart:hover .remove-icon {
    opacity: 1;
}

.cart-summary {
    padding: 15px 20px;
    background: #fdfdfd;
}
.cart-prices-line {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}
.cart-prices-line.total {
    font-weight: bold;
    font-size: 16px;
}

.cart-buttons {
    padding: 20px;
    border-top: 1px solid #eee;
}
.cart-buttons .btn {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    padding: 12px;
    background: #af2200;
    color: #fff;
    border: none;
    border-radius: 5px;
    transition: background 0.3s ease;
}
.cart-buttons .btn:hover {
    background: #8e1b00;
}
.arrow-right {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-left: 8px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23fff"><path d="m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg>') no-repeat center center;
}

p.cart_block_no_products {
    text-align: center;
    padding: 40px 20px;
    color: #777;
}

/* --- RESPONSIVE --- */
@media (max-width: 767px) {
    .cart_title {
        display: none; /* Ukryj napis "Cart" na mobile */
    }
    .cart_block_list {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 320px;
        height: 100%;
        border-radius: 0;
        border: none;
        transform: translateX(100%);
    }
    .cart_block_list.open {
        transform: translateX(0);
    }
}
