/* Shopping Cart Styles */

/* Cart Button Styles */
.cart-btn, .cart-button {
    position: relative;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.cart-btn:hover, .cart-button:hover {
    background: #1e2936;
    transform: translateY(-1px);
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

/* Cart Sidebar Styles */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

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

.cart-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.cart-sidebar-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 10000;
}

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

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.close-cart {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-cart:hover {
    color: var(--primary-color);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-cart {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    position: relative;
}

.cart-item:last-child {
    border-bottom: none;
}

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

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

.cart-item-details h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.3;
}

.cart-item-price {
    margin: 0 0 0.25rem 0;
    font-weight: 500;
    color: #666;
    font-size: 0.8rem;
}

.cart-item-total {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: #2e7d32;
    font-size: 0.9rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #e9ecef;
    border-color: var(--primary-color);
}

.quantity {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.remove-item {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.cart-total {
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.checkout-btn, .clear-cart-btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.checkout-btn {
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
}

.checkout-btn:hover {
    background: #1e2936;
    transform: translateY(-1px);
}

.clear-cart-btn {
    background: #dc3545;
    color: white;
    font-size: 0.9rem;
}

.clear-cart-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Checkout Modal Styles */
.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.checkout-modal.active {
    opacity: 1;
    visibility: visible;
}

.checkout-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.checkout-modal.active .checkout-content {
    transform: translateY(0);
}

.checkout-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.checkout-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.close-checkout {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-checkout:hover {
    color: var(--primary-color);
}

.checkout-form {
    padding: 1.5rem;
}

.checkout-form h4 {
    margin: 0 0 1.5rem 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(42, 59, 76, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.checkout-summary {
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.checkout-summary h4 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1rem;
    border: none;
    padding: 0;
}

.order-items {
    margin-bottom: 1rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.order-item:last-child {
    border-bottom: none;
}

.order-total {
    padding-top: 1rem;
    border-top: 2px solid #ddd;
    text-align: right;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.checkout-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.place-order-btn,
.cancel-checkout-btn {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.place-order-btn {
    background: #28a745;
    color: white;
}

.place-order-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.cancel-checkout-btn {
    background: #6c757d;
    color: white;
}

.cancel-checkout-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Cart Notification */
.cart-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
}

.cart-notification.show {
    transform: translateX(0);
}

/* Add to Cart Button Enhancement */
.add-to-cart {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.add-to-cart:hover {
    background: #1e2936;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.add-to-cart:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-sidebar-content {
        width: 100%;
        max-width: 100%;
    }

    .checkout-content {
        width: 95%;
        margin: 1rem;
    }

    .checkout-actions {
        flex-direction: column;
    }

    .cart-notification {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }

    .cart-notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .cart-header {
        padding: 1rem;
    }

    .cart-items {
        padding: 0.5rem;
    }

    .cart-item {
        padding: 0.75rem;
    }

    .cart-footer {
        padding: 1rem;
    }

    .checkout-form {
        padding: 1rem;
    }
}

/* Animation for adding items */
@keyframes addToCartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.add-to-cart.adding {
    animation: addToCartPulse 0.3s ease;
}

/* Cart icon */
.cart-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Loading state */
.cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
}

.cart-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
