/* Floating Cart Button */
        .floating-cart-btn { 
            position: fixed; 
            right: 20px; 
            bottom: 20px; 
            z-index: 1400; 
            width: 72px; 
            height: 72px; 
            border-radius: 24px; 
            padding: 0; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            cursor: pointer; 
            box-shadow: 0 12px 28px rgba(0,0,0,0.2), 0 2px 4px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.2); 
            background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%); 
            color: #fff; 
            border: none; 
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .floating-cart-btn:focus { 
            outline: none; 
            box-shadow: 0 0 0 4px rgba(99,102,241,0.18), 0 12px 28px rgba(0,0,0,0.2); 
        }
        .floating-cart-btn:hover { 
            transform: translateY(-6px) scale(1.03); 
            box-shadow: 0 20px 32px rgba(0,0,0,0.24), 0 2px 8px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.2);
        }
        .floating-cart-badge { 
            position: absolute; 
            top: 4px; 
            right: 4px; 
            font-size: 0.75rem; 
            min-width: 24px; 
            height: 24px; 
            line-height: 24px; 
            border-radius: 12px; 
            display: inline-flex; 
            align-items: center; 
            justify-content: center; 
            padding: 0 8px; 
            background: #ef4444; 
            color: #fff; 
            font-weight: 600; 
            box-shadow: 0 4px 12px rgba(239,68,68,0.3); 
            transition: all 0.2s ease;
        }
        .cart-item-thumb { 
            width: 64px; 
            height: 64px; 
            object-fit: cover; 
            border-radius: 12px; 
            box-shadow: 0 2px 4px rgba(0,0,0,0.08);
        }

        .floating-cart-pulse { animation: floatingCartPulse 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
        @keyframes floatingCartPulse { 
            0% { transform: scale(1); } 
            30% { transform: scale(1.12); } 
            100% { transform: scale(1); } 
        }

        /* Cart Modal Styles */
        .offcanvas#floatingCartModal {
            border-left: 1px solid rgba(0,0,0,0.08);
            box-shadow: -8px 0 32px rgba(0,0,0,0.12);
        }
        .offcanvas-header {
            background: linear-gradient(to bottom, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-bottom: 1px solid rgba(0,0,0,0.08);
            padding: 1rem 1.25rem;
        }
        .offcanvas-body#floatingCartBody { 
            max-height: calc(100vh - 180px); 
            padding: 0; 
            display: flex; 
            flex-direction: column;
            background: #f8fafc;
        }

        /* Cart List Styles */
        #floatingCartModal .cart-list { 
            display: flex !important; 
            flex-direction: column !important; 
            flex: 1 1 auto !important; 
            overflow-y: auto !important;
            padding: 1.25rem;
            background: #ffffff;
            margin: 0;
        }
        #floatingCartModal .cart-list .list-group-item { 
            padding: 1rem; 
            background: #ffffff;
            margin-bottom: 1rem;
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            transition: all 0.2s ease;
            width: 100%;
            position: relative;
            /* allow controls to be visible outside inner bounds */
            overflow: visible;
        }
        #floatingCartModal .cart-list .list-group-item:last-child {
            margin-bottom: 0;
        }
        #floatingCartModal .cart-list .list-group-item:hover {
            border-color: #4f46e5;
            transform: translateY(-1px);
            box-shadow: 0 4px 16px rgba(79,70,229,0.08);
        }
        
        /* Item Layout */
        #floatingCartModal .cart-list .item-row { 
            display: grid !important;
            grid-template-columns: 56px 1fr auto;
            gap: 1rem;
            align-items: start;
            width: 100%;
        }
        #floatingCartModal .cart-list .item-row > img.cart-item-thumb,
        #floatingCartModal .cart-list .item-row > .cart-thumb-placeholder { 
            width: 56px; 
            height: 56px; 
            border-radius: 10px; 
            object-fit: cover;
            background: #f8fafc;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #f1f5f9;
        }
        #floatingCartModal .cart-list .item-row > .cart-thumb-placeholder i {
            font-size: 1.5rem;
            color: #cbd5e1;
        }
        #floatingCartModal .cart-list .item-content {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding-top: 2px;
        }
        #floatingCartModal .cart-list .item-info {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        #floatingCartModal .cart-list .item-meta { 
            font-size: 0.75rem; 
            color: #6b7280;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            line-height: 1.4;
            margin: 0;
        }
        #floatingCartModal .cart-list .item-meta span {
            display: inline-flex;
            align-items: center;
            background: #f3f4f6;
            padding: 4px 10px;
            border-radius: 6px;
            white-space: nowrap;
        }
        #floatingCartModal .cart-list .item-meta i {
            color: #6b7280;
            font-size: 0.75rem;
            margin-right: 5px;
        }
        #floatingCartModal .cart-list .item-price { 
            font-weight: 600; 
            color: #059669;
            font-size: 0.78rem; /* smaller for compact */
            background: #ecfdf5;
            padding: 4px 8px;
            border-radius: 6px;
            white-space: nowrap;
            display: inline-block; /* show as block when appended under meta */
            align-items: center;
            gap: 4px;
            border: 1px solid #d1fae5;
            margin: 4px 0 0 0;
        }
        #floatingCartModal .cart-list .item-price i {
            font-size: 0.75rem;
            color: #10b981;
        }
        #floatingCartModal .cart-list .remove-btn { 
            font-size: 0.8125rem;
            color: #ef4444;
            border: 1px solid #fecaca;
            background: #fff1f2;
            padding: 6px 12px;
            line-height: 1;
            border-radius: 6px;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-top: 4px;
            z-index: 8;
        }
        #floatingCartModal .cart-list .remove-btn i {
            font-size: 0.75rem;
        }
        #floatingCartModal .cart-list .remove-btn:hover {
            background: #fee2e2;
            border-color: #fca5a5;
            color: #dc2626;
            transform: translateY(-1px);
        }
        
        /* Item Details */
        #floatingCartModal .cart-list .text-end { 
            display: flex; 
            flex-direction: column; 
            align-items: flex-end; 
            gap: 6px;
            min-width: 120px;
            /* keep the right column stable and avoid shrinking which can hide controls */
            flex-shrink: 0;
            justify-self: end;
            align-self: center;
        }
        #floatingCartModal .cart-list .fw-semibold { 
            font-size: 0.9375rem;
            color: #111827;
            line-height: 1.4;
            font-weight: 600;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin: 0;
        }
        
        /* Cart Footer */
        #floatingCartModal .cart-footer { 
            padding: 1.25rem; 
            flex-shrink: 0;
            background: #ffffff;
            border-top: 1px solid #e5e7eb;
            position: relative;
            margin: 0;
        }
        #floatingCartModal .cart-footer::before {
            content: '';
            position: absolute;
            top: -32px;
            left: 0;
            right: 0;
            height: 32px;
            background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
            pointer-events: none;
        }
        .cart-footer .subtotal-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.25rem;
            padding-bottom: 1.25rem;
            border-bottom: 1px solid #e5e7eb;
        }
        .cart-footer .subtotal-label {
            font-size: 0.9375rem;
            color: #374151;
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0;
            font-weight: 500;
        }
        .cart-footer .subtotal-label i {
            color: #6b7280;
            font-size: 0.875rem;
            background: #f3f4f6;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
        }
        .cart-footer .subtotal-amount {
            font-size: 1.25rem;
            font-weight: 600;
            color: #059669;
            background: #ecfdf5;
            padding: 8px 16px;
            border-radius: 10px;
            border: 1px solid #d1fae5;
            margin: 0;
            box-shadow: 0 1px 2px rgba(5,150,105,0.05);
        }
        .cart-footer .cart-actions { 
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.75rem;
            padding: 0;
            margin: 0;
        }
        .cart-footer .cart-actions .btn { 
            padding: 0.75rem 1.5rem;
            font-size: 0.9375rem;
            border-radius: 10px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.2s ease;
            white-space: nowrap;
            height: 44px;
            margin: 0;
            width: 100%;
        }
        .cart-footer .cart-actions .btn i {
            font-size: 0.875rem;
        }
        .cart-footer .cart-actions .btn-primary {
            background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
            border: none;
            box-shadow: 0 2px 4px rgba(79,70,229,0.15), 0 8px 16px rgba(79,70,229,0.1);
        }
        .cart-footer .cart-actions .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(79,70,229,0.2), 0 12px 20px rgba(79,70,229,0.15);
        }
        .cart-footer .cart-actions .btn-outline-danger {
            background: #fff1f2;
            border: 1px solid #fecaca;
            color: #ef4444;
        }
        .cart-footer .cart-actions .btn-outline-danger:hover {
            background: #fee2e2;
            border-color: #fca5a5;
            color: #dc2626;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(239,68,68,0.1);
        }
        
        /* Empty Cart State */
        .cart-empty { 
            padding: 3rem 2rem; 
            text-align: center;
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            border-radius: 16px;
            margin: 1.25rem;
            border: 2px dashed #e2e8f0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        .cart-empty .empty-icon {
            font-size: 2.5rem;
            color: #4f46e5;
            margin-bottom: 1.5rem;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
            width: 80px;
            height: 80px;
            border-radius: 20px;
            box-shadow: 0 8px 16px -4px rgba(79,70,229,0.15);
            position: relative;
        }
        .cart-empty .empty-icon::after {
            content: '';
            position: absolute;
            inset: -4px;
            border: 2px dashed #4f46e5;
            border-radius: 22px;
            opacity: 0.3;
        }
        .cart-empty .empty-text {
            color: #1f2937;
            font-size: 1.125rem;
            margin-bottom: 0.75rem;
            font-weight: 600;
        }
        .cart-empty .empty-subtext {
            color: #6b7280;
            font-size: 0.9375rem;
            margin-bottom: 2rem;
            line-height: 1.5;
            max-width: 280px;
        }
        .cart-empty .btn {
            padding: 0.75rem 1.75rem;
            font-size: 0.9375rem;
            border-radius: 12px;
            font-weight: 600;
            background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
            border: none;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            box-shadow: 0 2px 4px rgba(79,70,229,0.15), 0 8px 16px rgba(79,70,229,0.1);
            transition: all 0.2s ease;
        }
        .cart-empty .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(79,70,229,0.2), 0 12px 20px rgba(79,70,229,0.15);
        }
        .cart-empty .btn i {
            font-size: 0.875rem;
        }
        
        /* Offcanvas Header */
        /* Offcanvas Container */
        .offcanvas#floatingCartModal {
            border-left: none;
            box-shadow: -8px 0 32px rgba(0,0,0,0.12);
            width: 380px !important;
            background: #ffffff;
        }
        
        /* Offcanvas Header */
        .offcanvas-header {
            padding: 1.25rem 1.25rem 1rem;
            background: #ffffff;
            border-bottom: 1px solid #e5e7eb;
            min-height: 60px;
            margin: 0;
            position: relative;
        }
        .offcanvas-header::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            right: 0;
            height: 1px;
            background: linear-gradient(90deg, #4f46e5 0%, #06b6d4 100%);
        }
        .offcanvas-header .offcanvas-title {
            font-size: 1.125rem;
            font-weight: 600;
            color: #111827;
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 0;
            line-height: 1.2;
        }
        .offcanvas-header .offcanvas-title i {
            color: #4f46e5;
            font-size: 1rem;
            background: #f5f3ff;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
        }
        .offcanvas-header .btn-close {
            padding: 0.75rem;
            margin: -0.75rem -0.75rem -0.75rem auto;
            background-size: 12px;
            opacity: 0.65;
            border-radius: 8px;
            transition: all 0.2s ease;
        }
        .offcanvas-header .btn-close:hover {
            opacity: 1;
            background-color: #f3f4f6;
            transform: rotate(90deg);
        }
/* Update cart item layout to accommodate the remove button */
#floatingCartModal .cart-list .item-row { 
    display: grid !important;
    grid-template-columns: 56px 1fr;
    gap: 1rem;
    align-items: start;
    width: 100%;
    position: relative; /* Container for absolute positioned remove button */
}

/* Position remove button in the top-right corner */
#floatingCartModal .cart-list .remove-btn { 
    font-size: 0.75rem;
    color: #ef4444;
    border: 1px solid #fecaca;
    background: #fff1f2;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(0, 0);
    z-index: 8;
}

/* Adjust spacing for remove button */
#floatingCartModal .cart-list .list-group-item {
    padding: 0.75rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.45rem;
    overflow: visible; /* allow controls to sit outside inner bounds */
}

/* Floating Cart Button Enhancements */
    .floating-cart-btn {
        animation: bounce 2s infinite;
    }
    @keyframes bounce {
        0%, 20%, 50%, 80%, 100% {
            transform: translateY(0);
        }
        40% {
            transform: translateY(-10px);
        }
        60% {
            transform: translateY(-5px);
        }
    }

    /* Enhanced Cart Modal */
    .offcanvas#floatingCartModal {
        background: linear-gradient(180deg, #ffffff, #f3f4f6);
        border-left: 2px solid #e5e7eb;
    }
    .offcanvas-header {
        background: #4f46e5;
        color: #ffffff;
        border-bottom: none;
    }
    .offcanvas-header .btn-close {
        background: #ffffff;
        color: #4f46e5;
    }

    /* Compact Item Layout */
    .cart-list .list-group-item {
        padding: 0.35rem 0.45rem;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 0.45rem;
        overflow: visible; /* allow controls to sit outside inner bounds */
    }
    .cart-list .item-row {
        grid-template-columns: 40px 1fr auto;
        gap: 0.45rem;
        align-items: center;
    }
    #floatingCartModal .cart-item-thumb { 
        width: 40px; 
        height: 40px; 
        border-radius: 8px; 
        object-fit: cover;
    }
    .cart-list .item-price {
        font-size: 0.68rem;
        padding: 1px 5px;
        white-space: nowrap;
        display: inline-block;
        margin-top: 3px;
    }
    .cart-list .fw-semibold { 
        font-size: 0.76rem;
        font-weight: 500;
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .cart-list .item-meta { 
        font-size: 0.60rem; 
        gap: 5px;
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #6b7280;
    }
    .cart-list .item-meta span { 
        padding: 2px 6px; 
        border-radius: 6px; 
        font-size: 0.60rem;
    }
    .cart-list .remove-btn { 
        padding: 3px 6px; 
        font-size: 0.7rem; 
        z-index: 8;
    }
    /* Ensure item content doesn't force container width */
    .cart-list .flex-grow-1 { min-width: 0; }
    .cart-list .item-row .text-end { min-width: 72px; flex-shrink: 0; }

    /* Enhanced Footer */
    .cart-footer {
        background: #f9fafb;
        border-top: 2px solid #e5e7eb;
    }
    .cart-footer .btn {
        border-radius: 8px;
    }

    /* Empty Cart State */
    .cart-empty {
        background: linear-gradient(135deg, #f3f4f6, #ffffff);
        border: 2px dashed #cbd5e1;
    }
    .cart-empty .empty-icon {
        background: #e0e7ff;
        color: #4f46e5;
    }

/* Compact layout adjustments */
 @media (max-width: 576px) {
        .offcanvas#floatingCartModal { width: 320px !important; }
        .cart-list .item-row { grid-template-columns: 40px 1fr auto; gap: 0.45rem; }
        #floatingCartModal .cart-item-thumb { width: 40px; height: 40px; }
        .cart-list .fw-semibold { font-size: 0.82rem; font-weight: 500; }
        .cart-list .item-meta { font-size: 0.60rem; }
        .cart-list .item-price { font-size: 0.72rem; padding: 2px 6px; }
        .cart-list .item-meta span { padding: 2px 6px; }
        .cart-list .remove-btn { padding: 4px 6px; font-size: 0.72rem; }
        .cart-footer .subtotal-amount { font-size: 1.05rem; padding: 6px 12px; }
        .cart-footer .cart-actions .btn { height: 40px; font-size: 0.88rem; }
    }