/* ========================================
   DUAL LAYOUT CARRELLO - VERSIONE COMPLETA
   Include fix per fascia 992-1199px
   ======================================== */

/* ==================== NASCONDI/MOSTRA LAYOUT GIUSTO ==================== */

.cart-desktop-view {
    display: block;
}

.cart-mobile-view {
    display: none;
}

@media (max-width: 767px) {
    .cart-desktop-view {
        display: none !important;
    }
    
    .cart-mobile-view {
        display: block !important;
    }
}

/* ==================== STILI DESKTOP BASE ==================== */

.table-product__thumb {
    max-width: 80px !important;
    max-height: 80px !important;
    min-width: 80px;
}

.table-product__thumb img {
    max-width: 60px !important;
}

.table-product.gap-24 {
    gap: 12px !important;
}

.table-product__content {
    max-width: 320px;
}

.table-product__content .title {
    font-size: 14px !important;
    line-height: 1.4;
    margin-bottom: 4px !important;
}

.table.style-three tbody tr td {
    padding: 16px 10px !important;
}

.table.style-three tbody tr td:first-child {
    padding-left: 0 !important;
}

.table.style-three tbody tr td:last-child {
    padding-right: 0 !important;
}

.table.style-three tbody tr td .text-lg {
    font-size: 15px !important;
}

.quantity__minus,
.quantity__plus {
    width: 36px !important;
    height: 36px !important;
}

.quantity__input {
    width: 40px !important;
    font-size: 14px !important;
}

.table.style-three thead th {
    font-size: 14px !important;
    padding: 12px 10px !important;
}

/* ==================== FIX CRITICO: 992px - 1199px ==================== */
@media (min-width: 992px) and (max-width: 1199px) {
    
    /* Riduzione padding contenitore */
    .cart-table {
        padding: 32px 20px !important;
    }
    
    /* Riduzione dimensioni immagini */
    .table-product__thumb {
        max-width: 70px !important;
        max-height: 70px !important;
        min-width: 70px !important;
    }
    
    .table-product__thumb img {
        max-width: 55px !important;
    }
    
    /* Riduzione gap */
    .table-product.gap-24 {
        gap: 10px !important;
    }
    
    /* Riduzione larghezza titolo */
    .table-product__content {
        max-width: 220px !important;
    }
    
    .table-product__content .title {
        font-size: 13px !important;
        line-height: 1.3 !important;
    }
    
    /* Riduzione padding celle */
    .table.style-three tbody tr td {
        padding: 14px 8px !important;
    }
    
    /* Riduzione header */
    .table.style-three thead th {
        font-size: 13px !important;
        padding: 10px 8px !important;
    }
    
    /* Riduzione font prezzi */
    .table.style-three tbody tr td .text-lg {
        font-size: 14px !important;
    }
    
    /* Riduzione pulsanti */
    .quantity__minus,
    .quantity__plus {
        width: 34px !important;
        height: 34px !important;
    }
    
    .quantity__input {
        width: 38px !important;
        height: 34px !important;
        font-size: 13px !important;
    }
    
    /* Nessun overflow */
    .overflow-x-auto {
        overflow-x: hidden !important;
    }
    
    /* Ottimizzazione container */
    .cart .container,
    .cart .container-lg {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
    
    /* Riduzione sidebar */
    .cart-sidebar {
        padding: 24px 16px !important;
    }
}

/* ==================== FASCIA ANCORA PIÙ STRETTA: 992px - 1099px ==================== */
@media (min-width: 992px) and (max-width: 1099px) {
    
    .cart-table {
        padding: 28px 16px !important;
    }
    
    .table-product__thumb {
        max-width: 65px !important;
        max-height: 65px !important;
        min-width: 65px !important;
    }
    
    .table-product__thumb img {
        max-width: 50px !important;
    }
    
    .table-product.gap-24 {
        gap: 8px !important;
    }
    
    .table-product__content {
        max-width: 200px !important;
    }
    
    .table-product__content .title {
        font-size: 12px !important;
    }
    
    .table.style-three tbody tr td {
        padding: 12px 6px !important;
    }
    
    .table.style-three thead th {
        font-size: 12px !important;
        padding: 10px 6px !important;
    }
    
    .table.style-three tbody tr td .text-lg {
        font-size: 13px !important;
    }
    
    .quantity__minus,
    .quantity__plus {
        width: 32px !important;
        height: 32px !important;
    }
    
    .quantity__input {
        width: 36px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
}

/* ==================== DESKTOP GRANDE (>= 1200px) ==================== */
@media (min-width: 1200px) {
    .cart-table {
        padding: 40px 32px !important;
    }
    
    .table-product__content {
        max-width: 350px;
    }
}

/* ==================== TABLET (768px - 991px) ==================== */
@media (min-width: 768px) and (max-width: 991px) {
    .table-product__thumb {
        max-width: 70px !important;
        max-height: 70px !important;
        min-width: 70px;
    }
    
    .table-product__thumb img {
        max-width: 50px !important;
    }
    
    .table-product__content {
        max-width: 200px;
    }
    
    .table-product__content .title {
        font-size: 13px !important;
    }
    
    .table.style-three tbody tr td {
        padding: 12px 8px !important;
    }
    
    .table.style-three tbody tr td .text-lg {
        font-size: 14px !important;
    }
    
    .quantity__minus,
    .quantity__plus {
        width: 32px !important;
        height: 32px !important;
    }
    
    .quantity__input {
        width: 36px !important;
        font-size: 13px !important;
    }
}

/* ==================== MOBILE - CARD LAYOUT ==================== */

@media (max-width: 767px) {
    .cart-table {
        padding: 20px 16px !important;
    }
    
    .cart-product-card {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
    
    .cart-product-card:last-child {
        margin-bottom: 0;
    }
    
    .card-product-info {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .card-product-thumb {
        flex-shrink: 0;
        width: 70px;
        height: 70px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    
    .card-product-thumb img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        padding: 5px;
    }
    
    .card-product-details {
        flex: 1;
        min-width: 0;
    }
    
    .card-product-title {
        font-size: 14px;
        font-weight: 600;
        line-height: 1.4;
        margin: 0;
        color: #1f2937;
    }
    
    .card-product-title a {
        color: inherit;
        text-decoration: none;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .card-product-title a:hover {
        color: #0580B9;
    }
    
    .card-product-prices {
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        margin-bottom: 12px;
    }
    
    .card-price-item {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .card-price-label {
        font-size: 12px;
        color: #6b7280;
        font-weight: 500;
    }
    
    .card-price-value {
        font-size: 14px;
        color: #0580B9;
        font-weight: 700;
    }
    
    .card-product-quantity {
        padding-top: 12px;
        border-top: 1px solid #f3f4f6;
    }
    
    .card-quantity-label {
        display: block;
        font-size: 12px;
        color: #6b7280;
        font-weight: 500;
        margin-bottom: 8px;
    }
    
    .card-quantity-controls {
        display: flex;
        align-items: center;
        gap: 0;
        width: fit-content;
    }
    
    .quantity-btn-mobile {
        width: 36px;
        height: 36px;
        border: 1px solid #e5e7eb;
        background: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 16px;
        color: #6b7280;
    }
    
    .quantity-btn-mobile:hover {
        background: #0580B9;
        color: #fff;
        border-color: #0580B9;
    }
    
    .quantity-btn-mobile:active {
        transform: scale(0.95);
    }
    
    .quantity-minus {
        border-radius: 4px 0 0 4px;
        border-right: none;
    }
    
    .quantity-plus {
        border-radius: 0 4px 4px 0;
        border-left: none;
    }
    
    .quantity-input-mobile {
        width: 50px;
        height: 36px;
        border: 1px solid #e5e7eb;
        border-left: none;
        border-right: none;
        text-align: center;
        font-size: 14px;
        font-weight: 600;
        color: #1f2937;
        background: #f9fafb;
    }
    
    .quantity-input-mobile:focus {
        outline: none;
        background: #fff;
    }
}

/* ==================== EXTRA SMALL MOBILE (< 576px) ==================== */
@media (max-width: 575px) {
    .cart-table {
        padding: 16px 12px !important;
    }
    
    .cart-product-card {
        padding: 14px;
        margin-bottom: 14px;
    }
    
    .card-product-thumb {
        width: 65px;
        height: 65px;
    }
    
    .card-product-title {
        font-size: 13px;
    }
    
    .card-price-label {
        font-size: 11px;
    }
    
    .card-price-value {
        font-size: 13px;
    }
    
    .quantity-btn-mobile {
        width: 34px;
        height: 34px;
    }
    
    .quantity-input-mobile {
        width: 45px;
        height: 34px;
        font-size: 13px;
    }
}

/* ==================== ULTRA SMALL (< 400px) ==================== */
@media (max-width: 399px) {
    .cart-table {
        padding: 14px 10px !important;
    }
    
    .cart-product-card {
        padding: 12px;
    }
    
    .card-product-thumb {
        width: 60px;
        height: 60px;
    }
    
    .card-product-title {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .card-product-prices {
        gap: 12px;
    }
    
    .quantity-btn-mobile {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .quantity-input-mobile {
        width: 42px;
        height: 32px;
        font-size: 12px;
    }
}

/* ==================== FIX CONTAINER RESPONSIVE ==================== */
@media (max-width: 767px) {
    .container, .container-lg {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    .cart.py-80 {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }
    
    .cart-sidebar.sticky-div {
        position: relative !important;
        top: auto !important;
        width: 100% !important;
    }
}

@media (max-width: 575px) {
    .container, .container-lg {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .cart.py-80 {
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }
}