/**
 * Carrito Lateral - Estilos
 * Carrito deslizante desde la derecha
 */

/* ========== CARRITO LATERAL ========== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px; /* Oculto inicialmente */
    width: 450px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease-in-out;
    z-index: 9999;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cart-sidebar.open {
    right: 0; /* Mostrar carrito */
}

/* Overlay de fondo */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 9998;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========== HEADER DEL CARRITO ========== */
.cart-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cart-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cart-close:hover {
    background: #e9ecef;
    color: #333;
}

.cart-count {
    background: #FFD700;
    color: #333;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 10px;
}

/* ========== CONTENIDO DEL CARRITO ========== */
.cart-content {
    flex: 1;
    padding: 0;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.cart-empty i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

.cart-empty h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #666;
}

.cart-empty p {
    color: #999;
    font-size: 0.9rem;
}

/* ========== ITEMS DEL CARRITO ========== */
.cart-items {
    padding: 0;
}

.cart-item {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

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

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

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-brand {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 500;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-item-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.cart-item-price-old {
    font-size: 0.9rem;
    color: #999;
    text-decoration: line-through;
    margin-left: 5px;
}

/* ========== CONTROLES DE CANTIDAD ========== */
.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.quantity-btn {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #e9ecef;
    color: #333;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-input {
    border: none;
    width: 50px;
    height: 32px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    background: #fff;
    color: #333;
}

.quantity-input:focus {
    outline: none;
}

/* ========== BOTÓN ELIMINAR ========== */
.cart-item-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    margin-left: 10px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.cart-item-remove:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333;
}

/* ========== RESUMEN DEL CARRITO ========== */
.cart-summary {
    padding: 20px;
    border-top: 2px solid #e9ecef;
    background: #f8f9fa;
    position: sticky;
    bottom: 0;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.cart-summary-row:last-child {
    margin-bottom: 0;
}

.cart-summary-label {
    color: #666;
}

.cart-summary-value {
    font-weight: 500;
    color: #333;
}

.cart-total {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
    margin-top: 15px;
}

.cart-total .cart-summary-row {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.cart-checkout-btn {
    width: 100%;
    background: #FFD700;
    color: #333;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-checkout-btn:hover {
    background: #FFC107;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.cart-checkout-btn:disabled {
    background: #e9ecef;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    .cart-item-name {
        font-size: 0.9rem;
    }
    
    .quantity-controls {
        scale: 0.9;
    }
}

@media (max-width: 480px) {
    .cart-header {
        padding: 15px;
    }
    
    .cart-item {
        padding: 15px;
    }
    
    .cart-summary {
        padding: 15px;
    }
}

/* ========== ANIMACIONES ========== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.cart-item {
    animation: fadeIn 0.3s ease-in-out;
}

/* ========== SCROLLBAR PERSONALIZADO ========== */
.cart-sidebar::-webkit-scrollbar {
    width: 6px;
}

.cart-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.cart-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}