/* Cart sidebar content styles */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1.5vw 0;
    max-height: calc(100vh - 8vw);
}

.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6vw;
    padding: 1vw 0;
    border-bottom: 0.1vw solid #e0e0e0;
    transition: opacity 0.3s ease;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    flex-shrink: 0;
    width: 6.1vw;
    height: 6.1vw;
    border-radius: 0.4vw;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.cart-item-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: top;
    transition: opacity 0.3s ease;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 1vw;
    font-family: 'Montserrat';
    color: #333;
    margin-bottom: 0.2vw;
    line-height: 1.3;
}

.cart-item-specs {
    font-size: 1vw;
    color: #666;
    margin-bottom: 0.2vw;
}

.cart-item-color,
.cart-item-size {
    font-weight: 500;
}

.cart-item-quantity {
    font-size: 1vw;
    color: #666;
    margin-bottom: 1vw;
}

.cart-item-price {
    font-weight: 700;
    font-size: 0.9vw;
    color: #333;
    font-family: sans-serif;
}

.cart-item-actions {
    flex-shrink: 0;
    width: 1.5vw;
    height: 1.5vw;
}

.cart-remove-btn {
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.2s ease;
    object-fit: contain;
}

.cart-remove-btn:hover {
    opacity: 0.8;
}

.cart-total {
    border-top: 0.15vw solid #333;
    padding: 1vw 0 0 0;
    margin-top: auto;
}

.cart-total-price {
    font-weight: 700;
    font-size: 1.1vw;
    color: #333;
    text-align: center;
}

.cart-loading,
.cart-empty,
.cart-error {
    text-align: center;
    padding: 2.5vw 1.2vw;
    color: #666;
    font-size: 1vw;
}

.cart-empty {
    color: #999;
}

.cart-error {
    color: #e74c3c;
}

/* Cart header styles */
.cart-header {
    padding-bottom: 0.7vw;
    border-bottom: 0.1vw solid #e0e0e0;
    margin-bottom: 0.5vw;
}

.cart-header h4 {
    margin: 0;
    padding: 0.5vw 0;
    font-size: 1.1vw;
    font-weight: 600;
    color: #333;
}

/* Enhanced sidebar layout */
#cart-sidebar {
    display: flex;
    flex-direction: column;
}

#cart-sidebar .cart-header {
    flex-shrink: 0;
}

#cart-sidebar #cart-items {
    flex: 1;
    overflow-y: auto;
}

#cart-sidebar .cart-total {
    flex-shrink: 0;
}

/* Loading animation */
.cart-loading {
    position: relative;
}

.cart-loading::after {
    content: '';
    position: absolute;
    right: -1.2vw;
    top: 50%;
    transform: translateY(-50%);
    width: 0.7vw;
    height: 0.7vw;
    border: 0.15vw solid #ddd;
    border-top: 0.15vw solid #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Cart Footer with Total */
.cart-footer {
    border-top: 1px solid rgba(60, 60, 60, 0.3);
    background: white;
    padding: 0.5vw 1vw;
    margin-top: auto;
    margin-bottom: 1.6vw;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    color: rgb(60, 60, 60);
    font-size: 1.1vw;
    font-family: 'Montserrat';
    font-weight: 700;
    border: none;
}

#cart-total-sign {
    color: rgb(60, 60, 60);
    font-size: 1.2vw;
    font-family: 'Montserrat';
}

#cart-total-amount {
    font-size: 1.2vw;
    font-family: 'Montserrat';
}

#checkout {
    padding: 1vw 14.9vw;
    background-color: rgb(60, 60, 60);
    color: white;
    border: none;
    border-radius: 5px;
    font-family: 'Cormorant';
    font-size: 1.3vw;
    font-weight: 700;
    margin-top: 1vw;
    transition: background-color 0.2s ease-in;
}

#checkout:hover {
    cursor: pointer;
    background-color: rgb(80, 80, 80);
}

/* ====== MOBILE LAYOUT ====== */

@media (max-width: 430px) {
    .cart-header {
        width: 96%;
        padding: 1.5vw 0;
        padding-left: 3vw;
        align-items: center;
    }

    #cart-close {
        margin-bottom: 0.5vw;
        width: 6.5vw;
        height: 6.5vw;
    }

    .cart-loading,
    .cart-empty,
    .cart-error {
        font-size: 4vw;
    }

    #cart-items {
        margin-top: 1vw;
        margin-left: 4vw;
        width: 94.2%;
    }
    
    .cart-item-image {
        width: 22vw;
        height: 22vw;
    }

    .cart-item-details {
        margin-top: 0.6vw;
        margin-left: 1vw;
    }

    .cart-item-name {
        font-size: 3.6vw;
    }

    .cart-item-specs {
        font-size: 3.2vw;
    }

    .cart-item-quantity {
        font-size: 3.2vw;
    }

    .cart-item-price {
        margin-top: 4.6vw;
        font-size: 3.4vw;
    }

    .cart-item-actions {
        width: 5vw;
        height: 5vw;
    }

    .cart-total {
        width: 95vw;
        margin-left: 2.2vw;
        font-size: 4vw;
    }

    #cart-total-sign {
        font-size: 4vw;
    }

    #cart-total-amount {
        font-size: 4vw;
    }

    #checkout {
        padding: 2.2vw 39.6vw;
        font-size: 4.4vw;
        margin: 2vw 0;
        margin-left: 2.2vw;
    }

    h4 {
        font-size: 3.5vw !important;
    }
}