/* css/cart.css */
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 20px;
    align-items: start;
}

.cart-items {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.cart-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}
.select-all-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
}
#select-all-checkbox {
    width: 18px;
    height: 18px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 20px; /* Increased padding slightly for tag space */
    border-bottom: 1px solid #e0e0e0;
    position: relative; /* [MODIFIED] Added for positioning context */
    overflow: hidden; /* [MODIFIED] Added to contain the tag */
}
.cart-item:last-child {
    border-bottom: none;
}

/* [NEW] Style for the Free Delivery Tag */
.free-delivery-tag {
    position: absolute;
    top: 10px;
    left: -2px;
    background-color: #28a745;
    color: white;
    padding: 4px 10px;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 0 4px 4px 0;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.2);
    z-index: 1;
}

.cart-item-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 15px;
    flex-shrink: 0;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 20px;
}

.cart-item-details {
    flex-grow: 1;
}
.cart-item-details h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 5px;
}
.cart-item-details .item-size {
    font-size: 0.9em;
    color: #6c757d;
}

/* [NEW] Styles for item variants (size, color) */
.cart-item-details .item-variant {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.9em;
    color: #6c757d;
}
.cart-item-color-thumb {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: transform 0.2s;
}
.cart-item-color-thumb:hover {
    transform: scale(1.2);
    border-color: var(--primary-color);
}


.cart-item-price {
    font-weight: 500;
    width: 100px;
    text-align: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    width: 120px;
    justify-content: center;
}
.quantity-selector button {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    cursor: pointer;
    font-size: 1.2em;
    transition: background-color 0.2s;
}
.quantity-selector button:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #adb5bd;
}
.quantity-selector input {
    width: 40px;
    height: 30px;
    text-align: center;
    border: 1px solid #ccc;
    border-left: none;
    border-right: none;
    -moz-appearance: textfield;
}
.quantity-selector input::-webkit-outer-spin-button,
.quantity-selector input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item-total {
    font-weight: 700;
    width: 100px;
    text-align: right;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #d32f2f;
    font-size: 1.4em;
    cursor: pointer;
    margin-left: 20px;
    transition: color 0.2s;
}
.remove-item-btn:hover {
    color: #a02121;
}

.order-summary {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 20px;
}
.order-summary h3 {
    margin-bottom: 20px;
}
.summary-details p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.1em;
}
.summary-details .total {
    font-weight: 700;
    font-size: 1.3em;
}

.checkout-button {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    font-weight: 600;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.checkout-button:hover:not(:disabled) {
    background-color: #5300a2;
}
.checkout-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.empty-cart-message {
    text-align: center;
    padding: 50px 20px;
    font-size: 1.2em;
    color: #6c757d;
}

.recommended-products {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

#recommended-products-container {
    margin-top: 20px;
}

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1002; padding: 20px; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content { background-color: #fff; color: #333; padding: 30px; border-radius: 8px; width: 100%; max-width: 500px; position: relative; box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2); transform: scale(0.95); transition: transform 0.3s ease; }
.modal-overlay:not(.hidden) .modal-content { transform: scale(1); }
.confirm-modal-content { max-width: 400px; text-align: center; }
#confirm-message { font-size: 1.2em; margin-bottom: 25px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: center; gap: 15px; }
.confirm-btn { padding: 10px 25px; border: none; border-radius: 5px; font-size: 1em; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.confirm-btn:hover { opacity: 0.85; }
.yes-btn { background-color: #d9534f; color: white; }
.no-btn { background-color: #6c757d; color: white; }

/* [NEW] Image Viewer Modal Styles */
.image-viewer-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}
.image-viewer-content img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
}
.image-viewer-content .close-modal-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    background: white;
    color: black;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Responsive Design */
@media (max-width: 992px) {
    .cart-layout { grid-template-columns: 1fr; }
    .order-summary { position: static; margin-top: 20px; }
}
@media (max-width: 768px) {
    .cart-item { flex-wrap: wrap; position: relative; }
    .remove-item-btn { position: absolute; top: 10px; right: 10px; }
    .cart-item-checkbox { margin-right: 10px; }
    .cart-item-image { width: 60px; height: 60px; }
    .cart-item-details { width: calc(100% - 100px); /* Adjusted for checkbox and image */ }
    .cart-item-price, .quantity-selector, .cart-item-total { width: 33.33%; margin-top: 15px; text-align: center; padding: 0 5px; }
    .cart-item-total { text-align: right; font-size: 1.1em; }
    .free-delivery-tag { font-size: 0.7em; top: 5px; }
    
    /* Hide footer on mobile devices for this page */
    footer {
        display: none;
    }

    /* [NEW] Add space at the bottom for the mobile nav bar */
    .recommended-products {
        padding-bottom: 40px;
    }
}