.cart-container {
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh; 
    min-height: 0;
}

/* Header - fixed size */
.cart-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0; 
}

.cart-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.free-shipping-banner {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 8px;
}

.shipping-progress {
    width: 100%;
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.shipping-progress-bar {
    height: 100%;
    background-color: var(--alternative-color);
    border-radius: 2px;
    transition: width 0.3s ease;
}


.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    min-height: 0; 
}

.cart-item {
    display: flex;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f4;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

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

.item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
}

.item-description {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    line-height: 1.3;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.quantity-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.quantity-input {
    width: 30px;
    text-align: center;
    border: none;
    font-size: 14px;
    color: #333;
    background: transparent;
}

.item-price {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    padding-right: 24px;
    margin-left: auto;
    flex-shrink: 0;
}

.remove-btn {
    position: absolute;
    top: 12px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.remove-btn:hover {
    color: #dc3545;
}


.cart-summary {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
    flex-shrink: 0; /* Don't shrink */
}

.subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.subtotal-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.subtotal-amount {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.tax-info {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 16px;
    line-height: 1.4;
}

.cart-actions {
    display: flex;
    gap: 12px;
}

.btn-cart {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cart-primary {
    background-color: var(--alternative-color);
    color: white;
}

.btn-cart-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

.btn-cart-secondary {
    background: white;
    color: #333;
    border: 1px solid #dee2e6;
}

.btn-cart-secondary:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

/* Overlay */
#cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    pointer-events: none;
}

#cart-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .cart-drawer {
        width: 100%;
        right: -100%;
    }
    
    .cart-container {
        max-width: none;
        border-radius: 0;
        height: 100vh; 
    }
    
  
    .cart-header {
        padding: 16px;
    }
    
    .cart-summary {
        padding: 16px;
    }
    
    .cart-items {
        padding: 0 16px;
    }
    
    .cart-item {
        padding: 12px 16px;
    }
    
   
    .cart-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-cart {
        padding: 14px 16px;
        font-size: 16px;
    }
}


@media (max-width: 480px) {
    .cart-header {
        padding: 12px;
    }
    
    .cart-summary {
        padding: 12px;
    }
    
    .cart-items {
        padding: 0 12px;
    }
}

/* ===== MODIFICACIONES PRINCIPALES ===== */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    height: 100vh;
    width: 400px;
    max-width: 100%;
    background: #fff;
    z-index: 9999;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease-in-out;
    visibility: hidden;
}

.cart-drawer.open {
    right: 0;
    visibility: visible;
}

#cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; 
    z-index: 9998; /* Menor que el carrito */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    pointer-events: none; 
}

#cart-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; 
}




.item-price del {
    color: #6c757d;
    font-size: 13px;
    margin-right: 6px;
}

.item-price ins {
    color: #e63946;
    font-weight: 700;
    text-decoration: none;
    font-size: 15px;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
        height: auto;
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* ===== RESPONSIVE ACTUALIZADO ===== */
@media (max-width: 600px) {
    .cart-drawer {
        width: 90vw;
        right: -90vw; 
    }
    
    .cart-drawer.open {
        right: 0; /* Se desliza completamente */
    }

    /* En móvil, el overlay puede tener una leve opacidad para indicar que está activo */
    #cart-overlay.active {
        background: rgba(0, 0, 0, 0.1); /* Muy sutil en móvil */
        opacity: 1;
        visibility: visible;
    }

    .cart-container {
        border-radius: 16px 0 0 16px;
        max-width: 100vw;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    }

    .cart-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px 8px;
        position: relative;
    }

    .item-image {
        width: 52px;
        height: 52px;
        margin-bottom: 8px;
        margin-right: 0;
    }

    .item-details {
        min-width: 0;
        flex: 1;
        margin-bottom: 6px;
    }

    .item-price {
        padding-right: 0;
        margin: 0;
        margin-bottom: 4px;
        align-self: flex-end;
        font-size: 15px;
    }

    .remove-btn {
        top: 6px;
        right: 8px;
        font-size: 20px;
        z-index: 2;
    }

    .quantity-controls {
        margin-bottom: 0;
        gap: 6px;
    }

    .item-name,
    .item-description {
        font-size: 13px;
    }
}

@media (max-width: 400px) {
    .cart-drawer {
        width: 85vw;
        right: -85vw;
    }

    .cart-header,
    .cart-summary {
        padding: 12px;
    }

    .cart-items {
        padding: 0 4px;
    }

    .cart-actions {
        gap: 6px;
    }
}

/* Quita flechitas en todos los navegadores */
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input[type=number] {
    -moz-appearance: textfield;
}