/* =========================================
   SHOPPING CART STYLES
   ========================================= */

/* --- Cart Icon in Header --- */
.cart-trigger {
    position: relative;
    cursor: pointer;
    margin-left: 15px;
    font-size: 1.2rem;
    color: var(--text-color, #333);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.cart-trigger:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.8);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color, #e63946);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-count.bump {
    animation: bumpCount 0.3s ease;
}

@keyframes bumpCount {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
    }

    100% {
        transform: scale(1);
    }
}

/* --- Cart Drawer Overlay --- */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Cart Drawer --- */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0; /* Align to right edge */
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.2);
    /* Matches Navbar */
    backdrop-filter: blur(10px);
    /* Matches Navbar */
    -webkit-backdrop-filter: blur(10px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* Matches Navbar border-bottom */
    z-index: 9999;
    
    /* NEW: Transform based hiding */
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent drawer itself from scrolling */
}

/* Custom scrollbar for cart items */
.cart-items::-webkit-scrollbar {
    width: 5px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.cart-drawer.open {
    /* right: 0; REMOVED */
    transform: translateX(0);
}

/* Header */
.cart-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    /* White text */
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s;
}

.cart-close:hover {
    color: #ffffff;
}

/* Items List */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-empty-msg {
    text-align: center;
    color: #ffffff;
    /* Explicit White text */
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cart-empty-msg p {
    color: #ffffff;
}

.cart-empty-msg i {
    font-size: 2rem;
    opacity: 0.8;
}

/* Single Item */
.cart-item {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    /* Darker glass for items */
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    animation: slideInItem 0.3s ease forwards;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@keyframes slideInItem {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #ffffff;
    /* White text */
}

.cart-item-price {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    /* White text */
}

.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 6px;
    border-radius: 20px;
}

.qty-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #ffffff;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.qty-val {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 15px;
    text-align: center;
    color: #ffffff;
    /* White text */
}

.remove-btn {
    border: none;
    background: none;
    color: #ff8080;
    /* Brighter red for visibility */
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 5px;
    transition: opacity 0.2s;
}

.remove-btn:hover {
    opacity: 1;
}

/* Footer & Checkout */
.cart-footer {
    padding: 20px;
    padding-bottom: env(safe-area-inset-bottom, 25px);
    /* Fix for mobile browser bars */
    background: rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: 600;
    color: #ffffff;
    /* White text */
    font-size: 1.1rem;
}

.checkout-btn {
    width: 100%;
    padding: 14px;
    background: #25D366;
    /* WhatsApp Green */
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.checkout-btn:hover {
    background: #128C7E;
    transform: translateY(-2px);
}

/* --- ANIMATION: Water Drop / Flying Particle --- */
.cart-particle {
    position: fixed;
    width: 20px;
    height: 20px;
    background: var(--primary-color, #e63946);
    /* Or water blue if requested, but site theme matches better */
    border-radius: 50%;
    /* Create a tear-drop shape */
    border-top-right-radius: 0;
    transform: rotate(-45deg);

    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 0 10px rgba(230, 57, 70, 0.6);
    animation: pulseParticle 0.5s infinite alternate;
}

@keyframes pulseParticle {
    to {
        box-shadow: 0 0 15px rgba(230, 57, 70, 0.9);
    }
}

@media (max-width: 500px) {
    .cart-drawer {
        width: 100%;
        max-width: 100%; /* Ensure full width on mobile */
        height: 100%;
        /* Better for mobile browsers */
        height: -webkit-fill-available;
    }

    .cart-header {
        padding: 15px;
    }

    .cart-items {
        padding: 15px;
    }

    .cart-footer {
        padding: 15px;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}