/* Shopping Cart Styles */

/* Cart Icon */
.cart-icon {
    position: relative;
    z-index: 1001;
}

.cart-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gradient-primary);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.cart-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.cart-emoji {
    font-size: 1.5rem;
    color: white;
}

.cart-count {
    background: var(--pop-pink);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    position: absolute;
    top: -8px;
    right: -8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
}

/* Product Pricing and Actions */
.product-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-orange);
    text-align: center;
    margin: 1rem 0;
    font-family: var(--font-heading);
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    border-radius: var(--border-radius-small);
    padding: 0.5rem;
    box-shadow: var(--shadow-light);
    border: 2px solid rgba(255, 107, 53, 0.2);
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.qty-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

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

.quantity {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-brown);
    min-width: 30px;
    text-align: center;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.cart-open {
    overflow: hidden;
}

/* Cart Header */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 2px solid var(--cream-white);
    background: var(--gradient-primary);
    color: white;
}

.cart-header h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cart-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

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

.empty-cart {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--rich-brown);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-cart p:first-of-type {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-cart p:last-of-type {
    opacity: 0.8;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: var(--gradient-card);
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.item-emoji {
    font-size: 2rem;
}

.item-details h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin: 0 0 0.25rem 0;
    color: var(--dark-brown);
}

.item-price {
    color: var(--rich-brown);
    font-size: 0.9rem;
    margin: 0;
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.item-controls .qty-btn {
    width: 28px;
    height: 28px;
    font-size: 1rem;
}

.item-controls .quantity {
    font-size: 1rem;
    min-width: 20px;
}

.remove-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 4px;
    border-radius: 4px;
}

.remove-btn:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.1);
    transform: scale(1.1);
}

/* Cart Footer */
.cart-footer {
    border-top: 2px solid var(--cream-white);
    padding: 1.5rem;
    background: var(--soft-white);
}

.delivery-check {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-light);
}

.delivery-check input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(255, 107, 53, 0.2);
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.3s ease;
}

.delivery-check input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.delivery-check button {
    width: 100%;
    background: var(--gradient-secondary);
    color: var(--dark-brown);
    border: none;
    padding: 0.75rem;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delivery-check button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

#deliveryMessage {
    margin-top: 0.75rem;
}

#deliveryMessage .success {
    color: #27ae60;
    font-weight: 600;
}

#deliveryMessage .error {
    color: #e74c3c;
    font-weight: 600;
}

.cart-totals {
    margin-bottom: 1.5rem;
}

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

.cart-total-line.total {
    border-top: 2px solid var(--primary-orange);
    padding-top: 1rem;
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-brown);
}

.checkout-btn {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: var(--border-radius-small);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-body);
}

.checkout-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-heavy);
}

.checkout-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Added to Cart Message */
.added-to-cart-message {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--gradient-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-heavy);
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.added-to-cart-message.show {
    transform: translateY(0);
    opacity: 1;
}

.message-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.message-emoji {
    font-size: 1.5rem;
}

.message-content p {
    margin: 0;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100vw;
        right: -100vw;
    }
    
    .cart-header {
        padding: 1.5rem;
    }
    
    .cart-items {
        padding: 1rem;
    }
    
    .cart-item {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .item-info {
        justify-content: center;
    }
    
    .cart-footer {
        padding: 1rem;
    }
    
    .product-actions {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .quantity-selector {
        flex: 1;
        max-width: 140px;
        justify-content: center;
    }
    
    .product-btn {
        flex: 2;
        margin-left: 1rem;
    }
    
    .added-to-cart-message {
        bottom: 10px;
        left: 10px;
        right: 10px;
        padding: 0.75rem 1rem;
    }
    
    .message-content {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .quantity-selector {
        gap: 0.5rem;
        padding: 0.25rem;
    }
    
    .qty-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .cart-header h3 {
        font-size: 1.5rem;
    }
    
    .product-price {
        font-size: 1.5rem;
    }
}

/* Animation for cart count */
@keyframes cartBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) scale(1);
    }
    40% {
        transform: translateY(-8px) scale(1.1);
    }
    60% {
        transform: translateY(-4px) scale(1.05);
    }
}

.cart-count.updated {
    animation: cartBounce 0.8s ease;
}

/* Hover effects for product cards with cart functionality */
.product-card:hover .quantity-selector {
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

/* Loading state for buttons */
.product-btn.loading,
.checkout-btn.loading {
    position: relative;
    color: transparent;
}

.product-btn.loading::after,
.checkout-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}