/* ===== MOBILE CART STYLES - FULL RWD ===== */

/* Przycisk toggle specs - ZAWSZE widoczny na mobile */
body.woocommerce-cart .shop_table td.product-name .cart-toggle-specs {
    display: none !important; /* Domyślnie ukryty */
}

@media (max-width: 768px) {
    /* Pokaż przycisk tylko na mobile */
    body.woocommerce-cart .shop_table td.product-name .cart-toggle-specs {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 16px !important;
        margin: 12px 0 !important;
        background: #f0f0f0 !important;
        border: 1px solid #ddd !important;
        border-radius: 6px !important;
        color: #333 !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        text-align: center !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    
    body.woocommerce-cart .shop_table td.product-name .cart-toggle-specs:hover,
    body.woocommerce-cart .shop_table td.product-name .cart-toggle-specs:focus {
        background: #e0e0e0 !important;
        outline: none !important;
    }
    
    body.woocommerce-cart .shop_table td.product-name .cart-toggle-specs::before {
        content: "+ " !important;
        font-weight: bold !important;
        margin-right: 5px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-name .cart-toggle-specs.active::before {
        content: "- " !important;
    }
}

/* Na mobile CAŁKOWICIE ukrywamy tabelę i robimy custom layout */
@media (max-width: 768px) {

    body div.e-cart__container {
        display: block !important;
    }
    
    /* NADPISANIE WSZYSTKICH STYLÓW ELEMENTORA I WOOCOMMERCE */
    body.woocommerce-cart .elementor-widget-container,
    body.woocommerce-cart .elementor-section,
    body.woocommerce-cart .elementor-column,
    body.woocommerce-cart .woocommerce,
    body.woocommerce-cart .woocommerce-cart-form,
    body.woocommerce-cart .woocommerce-cart-form__contents,
    body.woocommerce-cart table.shop_table,
    body.woocommerce-cart .shop_table thead,
    body.woocommerce-cart .shop_table tbody,
    body.woocommerce-cart .shop_table tr,
    body.woocommerce-cart .shop_table th,
    body.woocommerce-cart .shop_table td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        float: none !important;
        flex: none !important;
    }
    
    /* Ukryj nagłówki tabeli */
    body.woocommerce-cart .shop_table thead {
        display: none !important;
    }
    
    /* WYMUSZENIE STRUKTURY KOLUMNOWEJ - nadpisanie Elementora */
    body.woocommerce-cart .elementor-row,
    body.woocommerce-cart .elementor-column-wrap,
    body.woocommerce-cart .elementor-widget-wrap {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex-direction: column !important;
    }
    
    body.woocommerce-cart .elementor-column {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
        float: none !important;
    }
    
    /* Każdy wiersz produktu = karta */
    body.woocommerce-cart .shop_table tbody tr.woocommerce-cart-form__cart-item,
    body.woocommerce-cart .shop_table tbody tr.cart_item {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 16px !important;
        margin-bottom: 16px !important;
        background: #fff !important;
        border: 1px solid #e5e5e5 !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }
    
    /* Obrazek produktu */
    body.woocommerce-cart .shop_table td.product-thumbnail {
        width: 100% !important;
        margin-bottom: 12px !important;
        text-align: center !important;
        display: block !important;
    }
    
    body.woocommerce-cart .shop_table td.product-thumbnail a,
    body.woocommerce-cart .shop_table td.product-thumbnail img {
        display: block !important;
        width: 120px !important;
        height: 120px !important;
        max-width: 120px !important;
        margin: 0 auto !important;
        object-fit: cover !important;
        border-radius: 8px !important;
    }
    
    /* Nazwa produktu */
    body.woocommerce-cart .shop_table td.product-name {
        width: 100% !important;
        margin-bottom: 12px !important;
        text-align: center !important;
        display: block !important;
    }
    
    body.woocommerce-cart .shop_table td.product-name a {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #333 !important;
        text-decoration: none !important;
        display: block !important;
    }
    
    /* Ukryj szczegóły konfiguracji domyślnie */
    body.woocommerce-cart .shop_table td.product-name dl.variation,
    body.woocommerce-cart .shop_table td.product-name .woocommerce-product-details__short-description {
        display: none !important;
        margin-top: 12px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-name dl.variation.show,
    body.woocommerce-cart .shop_table td.product-name .woocommerce-product-details__short-description.show {
        display: block !important;
    }
    
    /* Style dla wyświetlanych szczegółów */
    body.woocommerce-cart .shop_table td.product-name dl.variation {
        background: #f9f9f9 !important;
        padding: 12px !important;
        border-radius: 6px !important;
        margin-top: 12px !important;
    }
    
    /* Ukryj cenę jednostkową */
    body.woocommerce-cart .shop_table td.product-price {
        display: none !important;
    }
    
    /* Kontener na ilość i sumę - jeden wiersz */
    body.woocommerce-cart .shop_table td.product-quantity,
    body.woocommerce-cart .shop_table td.product-subtotal {
        width: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        margin-bottom: 16px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Ilość - po lewej stronie */
    body.woocommerce-cart .shop_table td.product-quantity {
        justify-content: flex-start !important;
        padding-right: 8px !important;
        gap: 8px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-quantity::before {
        content: "Ilość:" !important;
        font-weight: 600 !important;
        font-size: 16px !important;
        margin-right: 4px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-quantity .quantity {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
    }
    
    /* Przyciski +/- jako okrągłe */
    body.woocommerce-cart .shop_table td.product-quantity .quantity .qty-button,
    body.woocommerce-cart .shop_table td.product-quantity .quantity input[type="button"] {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        border-radius: 50% !important;
        border: 1px solid #ddd !important;
        background: #fff !important;
        color: #333 !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        line-height: 1 !important;
    }
    
    body.woocommerce-cart .shop_table td.product-quantity input.qty {
        width: 40px !important;
        max-width: 40px !important;
        min-width: 40px !important;
        text-align: center !important;
        padding: 4px !important;
        border: none !important;
        background: transparent !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        -moz-appearance: textfield !important;
    }
    
    body.woocommerce-cart .shop_table td.product-quantity input.qty::-webkit-outer-spin-button,
    body.woocommerce-cart .shop_table td.product-quantity input.qty::-webkit-inner-spin-button {
        -webkit-appearance: none !important;
        margin: 0 !important;
    }
    
    /* Suma - po prawej stronie */
    body.woocommerce-cart .shop_table td.product-subtotal {
        justify-content: flex-end !important;
        text-align: right !important;
        padding-left: 8px !important;
        border: none !important;
    }
    
    body.woocommerce-cart .shop_table td.product-subtotal::before {
        content: "Suma: " !important;
        font-weight: 600 !important;
        margin-right: 6px !important;
        font-size: 16px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-subtotal .woocommerce-Price-amount {
        font-size: 18px !important;
        font-weight: 700 !important;
        color: #000 !important;
    }
    
    /* Przycisk usuń */
    body.woocommerce-cart .shop_table td.product-remove {
        width: 100% !important;
        text-align: center !important;
        order: -1 !important;
        margin-bottom: 12px !important;
        display: block !important;
    }
    
    body.woocommerce-cart .shop_table td.product-remove a.remove {
        display: inline-block !important;
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        background: #e74c3c !important;
        color: #fff !important;
        border-radius: 50% !important;
        text-align: center !important;
        font-size: 20px !important;
        text-decoration: none !important;
    }
    
    /* Akcje koszyka (zaktualizuj koszyk) */
    body.woocommerce-cart .shop_table td.actions {
        width: 100% !important;
        padding: 16px !important;
        text-align: center !important;
        display: block !important;
    }
    
    body.woocommerce-cart .shop_table td.actions .coupon {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }
    
    body.woocommerce-cart .shop_table td.actions .coupon input.input-text {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        box-sizing: border-box !important;
    }
    
    body.woocommerce-cart .shop_table td.actions .coupon button {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
        background: #333 !important;
        color: #fff !important;
        border: none !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        box-sizing: border-box !important;
    }
    
    body.woocommerce-cart .shop_table td.actions button[name="update_cart"] {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
        background: #0073aa !important;
        color: #fff !important;
        border: none !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        box-sizing: border-box !important;
    }
    
    /* Podsumowanie koszyka - cart totals - WYMUSZENIE JEDNEJ KOLUMNY */
    body.woocommerce-cart .cart-collaterals,
    body.woocommerce-cart .cart_totals {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 16px !important;
        box-sizing: border-box !important;
        float: none !important;
        clear: both !important;
    }
    
    body.woocommerce-cart .cart_totals h2 {
        font-size: 20px !important;
        margin-bottom: 16px !important;
        text-align: center !important;
    }
    
    body.woocommerce-cart .cart_totals table.shop_table {
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        display: block !important;
    }
    
    body.woocommerce-cart .cart_totals table.shop_table tbody,
    body.woocommerce-cart .cart_totals table.shop_table tr {
        display: block !important;
        width: 100% !important;
    }
    
    body.woocommerce-cart .cart_totals table.shop_table tr {
        display: flex !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 12px 0 !important;
        border-bottom: 1px solid #e5e5e5 !important;
    }
    
    body.woocommerce-cart .cart_totals table.shop_table th,
    body.woocommerce-cart .cart_totals table.shop_table td {
        display: inline-block !important;
        width: auto !important;
        max-width: 50% !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }
    
    body.woocommerce-cart .cart_totals table.shop_table td {
        text-align: right !important;
        font-weight: 600 !important;
    }
    
    body.woocommerce-cart .cart_totals .wc-proceed-to-checkout {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-top: 16px !important;
        box-sizing: border-box !important;
    }
    
    body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        text-align: center !important;
        background: #0073aa !important;
        color: #fff !important;
        text-decoration: none !important;
        border-radius: 4px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        box-sizing: border-box !important;
    }
    
    /* Opcje konfiguratora - również jedna kolumna */
    body.woocommerce-cart .configurator-options {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px !important;
        margin-top: 12px !important;
        display: none !important; /* Domyślnie ukryte na mobile */
    }
    
    body.woocommerce-cart .configurator-options.show {
        display: block !important; /* Pokazuj gdy klikniemy toggle */
    }
    
    body.woocommerce-cart .configurator-option {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        width: 100% !important;
    }
    
    body.woocommerce-cart .configurator-label,
    body.woocommerce-cart .configurator-value {
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    body.woocommerce-cart .shop_table tbody tr.woocommerce-cart-form__cart-item,
    body.woocommerce-cart .shop_table tbody tr.cart_item {
        padding: 12px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-thumbnail a,
    body.woocommerce-cart .shop_table td.product-thumbnail img {
        width: 100px !important;
        height: 100px !important;
        max-width: 100px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-name a {
        font-size: 14px !important;
    }
    
    body.woocommerce-cart .shop_table td.product-price .woocommerce-Price-amount,
    body.woocommerce-cart .shop_table td.product-subtotal .woocommerce-Price-amount {
        font-size: 16px !important;
    }
}
