/* ── Cart Sidebar / Modal Styles (cart.css) ──────────────────── */
/* Compatible con Bootstrap 3 + ASP.NET MVC 5 */

/* ══ Overlay backdrop ══ */
.cart-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

.cart-backdrop.open {
    opacity: 1;
    visibility: visible;
}

/* ══ Cart offcanvas panel ══ */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100%;
    background: #F8F9FA;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: none;
    will-change: transform;
}

.cart-sidebar.open {
    transform: translateX(0);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
}

/* ── Cart header ─────────────────────────────────────────────── */
.cart-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    color: #2D2D2D;
    flex-shrink: 0;
    border-bottom: 1px solid #E8E8E8;
}

.cart-header h4 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-close-btn {
    background: none;
    border: none;
    color: #4A4A4A;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    opacity: 0.85;
    transition: opacity .2s;
}

.cart-close-btn:hover { opacity: 1; }

/* ── Cart items area ─────────────────────────────────────────── */
.cart-items-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-item-row {
    background: #fff;
    padding: 14px 18px;
    border-bottom: 1px solid #F0F0F0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background .2s;
}

.cart-item-row:hover {
    background: #FAFBFC;
}

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

.cart-item-name strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.cart-item-price-unit {
    font-size: 13px;
    color: #6B7280;
}

/* ── Quantity controls ───────────────────────────────────────── */
.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1.5px solid #E0E0E0;
    background: #F5F6FA;
    color: #666;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s ease;
    padding: 0;
}

.cart-qty-btn:hover {
    background: #E8E8E8;
    border-color: #CCC;
}

.cart-qty-value {
    min-width: 26px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: #2C3E50;
}

/* ── Item subtotal + remove ──────────────────────────────────── */
.cart-item-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cart-item-subtotal {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.cart-remove-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1.5px solid transparent;
    background: transparent;
    color: #E74C3C;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s ease;
    padding: 0;
}

.cart-remove-btn:hover {
    background: #FDE8E8;
    border-color: #F5C6CB;
}

/* ── Empty cart state ────────────────────────────────────────── */
.cart-empty-state {
    text-align: center;
    padding: 60px 24px;
}

.cart-empty-icon {
    width: 80px;
    height: 80px;
    background: #E8E8E8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.cart-empty-icon span {
    font-size: 32px;
    color: #BDC3C7;
}

.cart-empty-msg {
    color: #7F8C8D;
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 12px;
}

/* ── Cart footer ─────────────────────────────────────────────── */
.cart-footer {
    background: #fff;
    border-top: 1px solid #E8E8E8;
    padding: 16px 20px;
    flex-shrink: 0;
}

.cart-subtotal-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #7F8C8D;
    margin-bottom: 4px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #E8E8E8;
    padding-top: 10px;
    margin-bottom: 14px;
}

.cart-total-label {
    font-weight: 700;
    font-size: 15px;
    color: #2C3E50;
}

.cart-total-value {
    font-weight: 800;
    font-size: 20px;
    color: #04A633;
}

/* ── Checkout CTA button (green Rappi) ─────────────────────── */
.cart-checkout-btn {
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    color: #fff;
    background: #04A633;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .25s ease;
    box-shadow: 0 4px 12px rgba(4,166,51,.25);
}

.cart-checkout-btn:hover {
    background: #028A29;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(4,166,51,.35);
}

/* ══ Cart Badge (header) — green Rappi ══ */
.cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #04A633;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 0 5px;
    line-height: 1;
    position: absolute;
    top: -4px;
    right: -8px;
}

.cart-badge.pulse {
    animation: cartPulse .5s ease;
}

@keyframes cartPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ══ Add-to-cart button (from product detail) ══ */
.add-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: all .25s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.add-cart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.add-cart-btn:active {
    transform: translateY(0);
}

/* ══ Responsive ══ */
@media (max-width: 768px) {
    .cart-sidebar {
        max-width: 100vw;
    }

    .cart-qty-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .cart-remove-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .cart-item-row {
        padding: 12px 14px;
        gap: 8px;
    }

    .cart-header h4 {
        font-size: 15px;
    }
}
