/* Shopping Cart Styles for Andy's Pie */

/* Cart Button */
#cart-button {
    position: relative;
    cursor: pointer;
    padding: 0.5rem 1rem;
    background-color: var(--primary-orange);
    color: white;
    border-radius: 9999px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

#cart-button:hover {
    background-color: var(--secondary-orange);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #f44336;
    color: white;
    border-radius: 9999px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Cart Drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

.cart-drawer.active {
    pointer-events: auto;
}

.cart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-drawer.active .cart-overlay {
    opacity: 1;
}

.cart-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-drawer.active .cart-content {
    transform: translateX(0);
}

/* Cart Header */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #f3f4f6;
}

.cart-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.cart-close:hover {
    background-color: #f3f4f6;
    color: var(--primary-orange);
}

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

.empty-cart {
    padding: 3rem 1.5rem;
    text-align: center;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f3f4f6;
    border-radius: 9999px;
    padding: 0.25rem;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.quantity-btn:hover {
    background-color: var(--primary-orange);
    color: white;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-display {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
    color: #111827;
}

.remove-item {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.remove-item:hover {
    background-color: #fee2e2;
}

/* Cart Footer */
.cart-footer {
    padding: 1.5rem;
    border-top: 2px solid #f3f4f6;
    background: #fafafa;
}

.free-delivery-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: #166534;
    font-weight: 500;
    font-size: 0.875rem;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

/* Mobile Cart Bar */
.mobile-cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 9998;
    display: none;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

/* Hide on desktop - only show on mobile */
@media (min-width: 769px) {
    .mobile-cart-bar {
        display: none !important;
    }
}

.mobile-cart-bar.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Hide mobile cart bar when cart drawer is open */
.mobile-cart-bar.cart-drawer-open {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.mobile-cart-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mobile-cart-info:active {
    transform: scale(0.98);
    background: #f3f4f6;
}

.mobile-cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-orange);
    flex-shrink: 0;
}

.mobile-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #f44336;
    color: white;
    border-radius: 9999px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    padding: 0 4px;
}

.mobile-cart-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-cart-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.mobile-cart-total {
    font-size: 1.125rem;
    font-weight: bold;
    color: var(--primary-orange);
}

.mobile-cart-checkout {
    background-color: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-cart-checkout:hover {
    background-color: var(--secondary-orange);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.mobile-cart-checkout:active {
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Add padding to body to prevent content from being hidden behind cart bar */
    body.has-mobile-cart {
        padding-bottom: 80px;
    }
}

@media (max-width: 640px) {
    .cart-content {
        max-width: 100%;
    }

    .cart-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cart-item-image {
        width: 100%;
        height: 150px;
    }

    .cart-item-actions {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .mobile-cart-bar {
        padding: 0.625rem 0.875rem;
    }

    .mobile-cart-info {
        padding: 0.625rem 0.875rem;
    }

    .mobile-cart-checkout {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* Free Delivery Banner */
.free-delivery-banner {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    position: sticky;
    top: 64px;
    z-index: 40;
}

.free-delivery-banner svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .free-delivery-banner {
        top: 64px;
        font-size: 0.8125rem;
        padding: 0.625rem 0.75rem;
    }
}

/* Animation Classes */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
