/**
 * Mobile Cart Button - Lieferando Flat Design
 * Clean, modern, flat design inspired by Lieferando
 */

/* Mobile Cart Button */
.mobile-cart-btn, #mobileCartBtn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* Hidden by default, shown via JS */
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    min-width: 200px;
    max-width: calc(100% - 40px);
    
    /* Flat Design - No gradients or shadows */
    background-color: #00AA00; /* Flat green */
    color: white;
    border: none;
    border-radius: 8px; /* Less rounded for modern look */
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    
    /* Subtle shadow for depth */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    
    /* Layout */
    z-index: 1000;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hover State */
.mobile-cart-btn:hover, #mobileCartBtn:hover {
    background-color: #009900; /* Slightly darker green */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(-50%) translateY(-2px);
}

/* Active State */
.mobile-cart-btn:active, #mobileCartBtn:active {
    background-color: #008800;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transform: translateX(-50%) translateY(0);
}

/* Cart Info Container */
.mobile-cart-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

/* Cart Count Badge */
.mobile-cart-count {
    background-color: white;
    color: #00AA00;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    min-width: 24px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Cart Total */
.mobile-cart-total {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Cart Icon */
.mobile-cart-btn i, #mobileCartBtn i {
    font-size: 20px;
    margin-right: 8px;
}

/* Warenkorb Text */
.mobile-cart-text {
    display: inline-block;
    margin: 0 8px;
}

/* Media Queries */
@media (max-width: 1200px) {
    .mobile-cart-btn, #mobileCartBtn {
        display: flex !important; /* Show on tablets and mobile */
    }
}

@media (max-width: 480px) {
    .mobile-cart-btn, #mobileCartBtn {
        bottom: 15px;
        padding: 2px 20px;
        min-width: 180px;
        font-size: 15px;
    }
    
    .mobile-cart-count {
        font-size: 13px;
        padding: 2px 6px;
    }
    
    .mobile-cart-total {
        font-size: 15px;
    }
}

/* Animation when cart updates */
@keyframes cartPulse {
    0% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
    100% {
        transform: translateX(-50%) scale(1);
    }
}

.mobile-cart-btn.cart-updated, #mobileCartBtn.cart-updated {
    animation: cartPulse 0.3s ease;
}

/* Hide on desktop */
@media (min-width: 1201px) {
    .mobile-cart-btn, #mobileCartBtn {
        display: none !important;
    }
}

/* Ensure button stays above other elements */
.mobile-cart-btn, #mobileCartBtn {
    z-index: 999;
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .mobile-cart-btn, #mobileCartBtn {
        -webkit-appearance: none;
    }
}

/* Mobile Cart Sidebar Toggle Styles */
@media (max-width: 1200px) {
    /* Cart Sidebar Mobile Styles */
    .cart-sidebar, #cartSidebar {
        position: fixed !important;
        top: 0;
        right: -100%; /* Hidden by default */
        width: 100%;
        max-width: 400px;
        height: 100vh;
        transition: right 0.3s ease-in-out;
        z-index: 1001;
        background: white;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    /* When open on mobile */
    .cart-sidebar.mobile-open, #cartSidebar.mobile-open {
        right: 0; /* Slide in from right */
    }
    
    /* Overlay for mobile cart */
    .cart-sidebar.mobile-open::before, #cartSidebar.mobile-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    /* Ensure content scrolls but summary stays fixed */
    .cart-sidebar .cart-content {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Keep checkout summary at bottom, above browser UI */
    .cart-sidebar .cart-summary {
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 2px solid #f1f5f9;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        padding-bottom: env(safe-area-inset-bottom, 20px); /* iOS safe area */
        z-index: 10;
    }
    
    /* Additional padding for iOS devices */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .cart-sidebar .cart-summary {
            padding-bottom: calc(16px + env(safe-area-inset-bottom));
        }
    }
}

/* On smaller screens, make cart full width */
@media (max-width: 480px) {
    .cart-sidebar, #cartSidebar {
        max-width: 100%;
    }
}