/* =============================================
   MINI CART STYLES
   ============================================= */

/* WRAPPER - wymagane dla pozycjonowania dropdownu */
.header-cart-wrapper {
    position: relative;
}

/* MINI CART DROPDOWN */
.mini-cart-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
    overflow: hidden;
}

.mini-cart-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mini-cart-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    z-index: -1;
}

/* Scrollable content area */
.mini-cart-dropdown .widget_shopping_cart_content {
    max-height: 600px;
    overflow-y: auto;
}

/* WooCommerce mini cart styling */
.mini-cart-dropdown .woocommerce-mini-cart {
    padding: 0;
    margin: 0;
    list-style: none;
}

.mini-cart-dropdown .woocommerce-mini-cart-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.2s;
}

.mini-cart-dropdown .woocommerce-mini-cart-item:hover {
    background: #fafafa;
}

.mini-cart-dropdown .woocommerce-mini-cart-item:last-child {
    border-bottom: none;
}

/* Product thumbnail link */
.mini-cart-dropdown .woocommerce-mini-cart-item > a:not(.remove) {
    flex-shrink: 0;
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 0;
    overflow: visible;
}

/* Product thumbnail - nadpisanie stylów WooCommerce */
.mini-cart-dropdown .woocommerce-mini-cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0;
    flex-shrink: 0;
    border: 1px solid #e8e8e8;
    display: block;
    max-width: 80px;
    max-height: 80px;
}

/* Hide text nodes inside product link (keep only image) */
.mini-cart-dropdown .woocommerce-mini-cart-item > a:not(.remove) {
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    text-indent: -9999px;
}

/* KRYTYCZNE: Ukryj domyślny layout WooCommerce */
.mini-cart-dropdown .woocommerce-mini-cart-item > a:not(.remove) * {
    max-width: 100%;
}

.mini-cart-dropdown .woocommerce-mini-cart-item > a:not(.remove):not(img) {
    display: inline;
    font-size: 0;
}

/* Hide original quantity display */
.mini-cart-dropdown .woocommerce-mini-cart-item .quantity {
    display: none;
}

/* Ukryj oryginalny przycisk usuwania */
.mini-cart-dropdown .woocommerce-mini-cart-item .remove {
    display: none !important;
}

/* Ukryj quantity display (1 ×) - nie potrzebne w naszym modelu */
.mini-cart-qty-display {
    display: none !important;
}

/* Ukryj quantity controls (+/-) - nie potrzebne w naszym modelu */
.mini-cart-quantity,
.mini-cart-qty-control {
    display: none !important;
}

/* ============================================
   KRYTYCZNE: Wymuś strukturę 2-kolumnową
   Ukryj WSZYSTKO oprócz obrazka i naszego kontenera
   ============================================ */

/* Ukryj wszystkie bezpośrednie dzieci domyślnie */
.mini-cart-dropdown .woocommerce-mini-cart-item > * {
    display: none !important;
}

/* Pokaż TYLKO link z obrazkiem (pierwszy link który nie jest .remove) */
.mini-cart-dropdown .woocommerce-mini-cart-item > a:not(.remove):first-of-type {
    display: block !important;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}

/* Pokaż TYLKO nasz kontener z detalami */
.mini-cart-dropdown .woocommerce-mini-cart-item > .mini-cart-item-details {
    display: flex !important;
    flex-direction: column;
}

/* Kontener info produktu - pełna dostępna szerokość */
.mini-cart-item-details {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Fix dla flex overflow */
    width: auto;
    max-width: calc(100% - 92px); /* 80px obrazek + 12px gap */
}

/* Nagłówek produktu: nazwa + X */
.mini-cart-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    position: relative;
}

.mini-cart-product-title {
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 700;
    color: #31343C;
    line-height: 1.4;
    min-width: 0;
    word-wrap: break-word;
}

.mini-cart-product-title a {
    color: inherit;
    text-decoration: none;
    display: block;
    width: 100%;
    background: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.mini-cart-product-title a:hover {
    color: var(--mint);
    background: none !important;
}

/* Przycisk usuń X - szary, hover: czerwone tło */
.mini-cart-remove-btn {
    background: none;
    border: none;
    padding: 0;
    margin: -4px 0 0 0;
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.mini-cart-remove-btn:hover {
    background: var(--status-error);
    color: var(--text-inverse);
    transform: none;
}

/* Atrybuty produktu (kolor, rozmiary, opcje Barn2) */
.mini-cart-product-attributes {
    margin-top: -20px;
    margin-left: 10px;
}

.mini-cart-product-attributes dl.variation {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1px 4px;
}

.mini-cart-product-attributes dl.variation dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    padding: 0;
    white-space: nowrap;
}



.mini-cart-product-attributes dl.variation dd {
    font-size: 12px;
    font-weight: 400;
    color: #666;
    margin: 0;
    padding: 0;
}


.mini-cart-product-attributes dl.variation dd p {
    display: inline;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding: 0;
    font-size: 12px;
    line-height: 1 !important;
}

/* Rozmiary w linii */
.mini-cart-product-attributes .sizes-list {
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mini-cart-product-attributes .size-row {
    display: inline !important;
    font-size: 12px;
    font-weight: 400;
    color: #666;
    line-height: 1;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

.mini-cart-product-attributes .size-row:not(:last-child)::after {
    content: ', ';
}

/* Cena na dole */
.mini-cart-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    margin-left: 10px;
    padding-right: 20px;
}

/* Cena produktu */
.mini-cart-item-total {
    font-size: 14px;
    font-weight: 700;
    color: #31343C;
    white-space: nowrap;
}

.mini-cart-item-unit-price {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    white-space: nowrap;
}

.mini-cart-item-unit-price .per-unit {
    font-size: 11px;
    color: var(--text-muted);
}

.mini-cart-price-separator {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 8px;
}

/* FOOTER */
.mini-cart-dropdown .woocommerce-mini-cart__total {
    margin: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(105, 164, 180, 0.08) 0%, rgba(26, 43, 74, 0.08) 100%);
    border-radius: 10px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0 12px;
    font-weight: 700;
    font-size: 16px;
    color: #1a2b4a;
    border: 1px solid rgba(26, 43, 74, 0.1);
}

.mini-cart-total-prices {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mini-cart-total-netto {
    font-size: 16px;
    font-weight: 700;
    color: #1a2b4a;
}

.mini-cart-total-brutto {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: -5px;
}

.mini-cart-total-brutto .woocommerce-Price-amount {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.mini-cart-dropdown .woocommerce-mini-cart__total strong {
    font-weight: 700;
}

.cart-price-line {
    display: block;
    text-align: right;
}

.cart-brutto-line {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.cart-brutto-line .woocommerce-Price-amount {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.cart-suffix {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.mini-cart-dropdown .woocommerce-mini-cart__buttons {
    padding: 0 20px 20px;
    margin: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    background: #fafafa;
    align-items: center;
}

.mini-cart-dropdown .woocommerce-mini-cart__buttons .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    padding: 16px 30px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    margin: 0;
    border: 2px solid #31343C;
    min-height: 50px;
}

.mini-cart-dropdown .woocommerce-mini-cart__buttons .wc-forward:first-child {
    background: transparent;
    color: #31343C;
    border: none;
    padding: 8px 0;
    min-height: auto;
    width: auto;
    text-decoration: underline;
    font-size: 14px;
    font-weight: 500;
}

.mini-cart-dropdown .woocommerce-mini-cart__buttons .wc-forward:first-child:hover {
    background: transparent;
    color: #1a2b4a;
    transform: none;
    text-decoration: underline;
}

.mini-cart-dropdown .woocommerce-mini-cart__buttons .checkout {
    background: #31343C;
    color: #fff;
    border: 2px solid #31343C;
    width: 100%;
}

.mini-cart-dropdown .woocommerce-mini-cart__buttons .checkout:hover {
    background: #1a2b4a;
    border-color: #1a2b4a;
    transform: translateY(-1px);
}

/* Empty cart message */
.mini-cart-dropdown .woocommerce-mini-cart__empty-message {
    padding: 40px 20px;
    text-align: center;
    color: #888;
}

/* NAGŁÓWEK KOSZYKA */
.mini-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    background: #fff;
}

.mini-cart-header-title {
    font-size: 15px;
    font-weight: 600;
    color: #31343C;
}

.mini-cart-header-count {
    background: #f0f0f0;
    color: #666;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* X do zamknięcia w nagłówku - okrągłe szare tło */
.mini-cart-close-btn {
    background: #f0f0f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: none;
}

.mini-cart-close-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: scale(1.1);
}

@media (max-width: 480px) {
    .mini-cart-dropdown {
        width: calc(100vw - 30px);
    }
}
