/* ===== CART SIDEBAR ===== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

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

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    z-index: 9999;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

/* Cart Header */
.cart-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e8e2de;
    background: #4a2c2a;
    color: #fff;
}

.cart-sidebar-header h3 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.cart-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Cart Empty */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    flex: 1;
}

.cart-empty svg {
    color: #ccc;
    margin-bottom: 16px;
}

.cart-empty p {
    font-size: 16px;
    color: #888;
    margin-bottom: 8px;
}

.cart-empty small {
    font-size: 13px;
    color: #aaa;
}

/* Cart Content */
.cart-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Cart Items */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #f9f7f6;
    margin-bottom: 12px;
    position: relative;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item-img {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

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

.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #2a2522;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.cart-item-name:hover {
    color: #4CAF50;
}

.cart-item-price {
    font-size: 15px;
    font-weight: 800;
    color: #2a2522;
    margin-top: 4px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    color: #4a2c2a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cart-qty-btn:hover {
    background: #f0ebe7;
    border-color: #4a2c2a;
}

.cart-item-qty span {
    font-size: 14px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.cart-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    color: #e53935;
    background: #fce4ec;
}

/* Cart Footer */
.cart-footer {
    padding: 16px 24px 24px;
    border-top: 2px solid #e8e2de;
    background: #fff;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cart-total-label {
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

.cart-total-value {
    font-size: 22px;
    font-weight: 800;
    color: #2a2522;
}

.cart-installment {
    font-size: 12px;
    color: #888;
    text-align: right;
    margin-bottom: 16px;
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    background: #4CAF50;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-checkout:hover {
    background: #43a047;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-continue {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #4a2c2a;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #e8e2de;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-continue:hover {
    border-color: #4a2c2a;
    background: #f9f7f6;
}

/* ===== FLY TO CART ANIMATION ===== */
.fly-to-cart {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f5e9;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* ===== CART ICON BOUNCE ===== */
.cart-bounce {
    animation: cartBounce 0.5s ease;
}

@keyframes cartBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    50% { transform: scale(0.9); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ===== BUTTON ANIMATIONS ===== */
.btn-success-pulse {
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.05); }
    60% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

/* Badge animation */
.cart-badge {
    transition: all 0.3s ease;
}

.cart-badge.has-items {
    background: #e53935 !important;
    color: #fff !important;
    animation: badgePop 0.4s ease;
}

@keyframes badgePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ===== RIPPLE EFFECT ===== */
.btn-add-cart, .btn-add-cart-detail {
    position: relative;
    overflow: hidden;
}

.btn-add-cart::after, .btn-add-cart-detail::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 1s;
}

.btn-add-cart:active::after, .btn-add-cart-detail:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
        max-width: 100vw;
        right: -100%;
    }
}
