/**
 * Slide-in Cart Styles
 * 
 * This file contains all CSS styles for the sliding cart functionality
 */

/* Base Style for the Slide-in Cart */
.cart-slidein {
    position: fixed;
    top: 0;
    padding: 1em;
    right: -170%;
    min-width: 350px;
    max-width: 500px;
    height: 100%;
    background-color: var(--white);
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease-in-out;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

/* Content within the Slide-in Cart */
.cart-slidein.open {
    right: 0;
}

.cart-slidein .cart-slidein-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

#cart-slidein small{
    font-size: small;
    color: var(--light-gray);
}

/* Close Button */
#close-cart {
    margin-left: auto;
    border: none;
    width: 36px;
    height: 35px;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--primary-red);
    border-radius: 50%;
    background-color: transparent;
}

#close-cart:hover {
    background-color: var(--primary-red);
    color: var(--white);
}

/* Flex Row (for title and close button) */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lightest-gray);
    padding: 0 0 1em;
    font-weight: 700;
}

/* Cart Contents */
#cart-contents {
    flex-grow: 1;
    overflow-y: auto;
}

.cart-items-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* Cart Item Style */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 0;
    border-bottom: 1px solid var(--lightest-gray);
    gap: 1em;
}

.cart-item-image img {
    max-width: 80px;
    height: auto;
    border: 1px solid var(--lightest-gray);
    display: block;
}

.cart-item-details {
    flex-grow: 1;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
}

.cart-item-name {
    font-weight: 500;
    line-height: 1;
}

.cart-item-name a {
    text-decoration: none;
    font-size: .8em;
}

.cart-item-price {
    color: var(--dark-gray);
    display: flex;
    flex-direction: column;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
}

.quantity-minus {
    margin-right: 8px;
}

.quantity-plus {
    margin-left: 8px;
}

.cart-item-quantity button {
    border: none;
    border-radius: 50%;
    background-color: var(--primary-red);
    color: var(--white);
    font-size: 1em;
    cursor: pointer;
    width: 30px;
    height: 30px;
}

.cart-item-quantity button:hover {
    background-color: var(--secondary-red);
}

/* Disabled button styles */
.cart-item-quantity button:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.cart-item-quantity button:disabled:hover {
    background-color: #ccc;
    color: #666;
}

/* Subtotal Section */
.cart-subtotal {
    padding-top: 20px;
    font-weight: 700;
    border-top: 1px solid var(--lightest-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

span#subtotal-amount {
    display: flex;
    flex-direction: column;
}

/* Action Buttons (fixed to the bottom) */
.action-btns {
    margin-top: auto;
    padding:  0 0 1em;
    display: flex;
    gap: 1em;
    flex-direction: column;
}

.cart-actions {
    display: flex;
    justify-content: space-between;
}

/* Style the checkout button */
.checkout-button {
    padding: 1em 2em;
    width: 100%;
    max-width: 100%;
}

.checkout-button:hover {
    background-color: var(--primary-red);
}

/* Add the arrow icon before the text */
.checkout-button::before {
    content: "\f312";
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: var(--black);
    border-right-color: var(--black);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Cart Notifications */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 300px;
    animation: slideInNotification 0.3s ease-out;
}

.cart-notification-error {
    border-color: #cc1818;
    background-color: #fff0f0;
}

.cart-notification-success {
    border-color: #4ab866;
    background-color: #f4fff7;
}

.cart-notification-warning {
    border-color: #f0b849;
    background-color: #fffbf4;
}

.cart-notification-message {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

@keyframes slideInNotification {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
} 