/**
 * Shopping Cart Styles
 * Phase 4.5: Shopping Cart
 */

/* Cart Grid Layout */
.cart-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 991px) {
    .cart-grid {
        grid-template-columns: 1fr;
    }
}

/* Button Styles */
.btn-checkout {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color, #0066cc);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    margin-top: 20px;
}

.btn-checkout:hover {
    background: var(--primary-hover-color, #0056b3);
    transform: translateY(-1px);
}

.btn-outline-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--secondary-color, #6c757d);
    border: 1px solid var(--secondary-color, #6c757d);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    background: var(--secondary-hover-color, #545b62);
    border-color: var(--secondary-hover-color, #545b62);
    color: #fff;
    text-decoration: none;
}

/* Page Layout */
.cart-section {
    background: #f8f9fa;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-title-color);
    margin-bottom: 5px;
}

.cart-summary-text {
    color: #6c757d;
    margin-bottom: 0;
}

/* Empty Cart */
.empty-cart-message {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.empty-cart-message i {
    font-size: 80px;
    color: #dee2e6;
    margin-bottom: 20px;
    display: block;
}

.empty-cart-message h3 {
    color: var(--text-title-color);
    margin-bottom: 10px;
}

.empty-cart-message p {
    color: #6c757d;
    margin-bottom: 25px;
}

/* Cart Items Container */
.cart-items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Individual Cart Item */
.cart-item {
    display: flex;
    flex-direction: column;
    padding: 25px 30px 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
    position: relative;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Cart Item Header */
.cart-item-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.cart-item-header .cart-item-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-title-color);
    margin: 0;
}

.cart-item-header .cart-item-spec {
    font-size: 0.95rem;
    color: #888;
}

/* Cart Item Body */
.cart-item-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
}

.cart-item.updating {
    opacity: 0.5;
    pointer-events: none;
}

.cart-item.removing {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-20px); }
}

/* Cart Item Image */
.cart-item-image {
    width: 280px;
    height: 280px;
    border-radius: 8px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.cart-item-image:hover {
    transform: scale(1.02);
}

.cart-item-image img {
    max-width: 260px;
    max-height: 260px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Magnifying glass icon overlay */
.cart-item-image::after {
    content: '\F52A'; /* Bootstrap Icons search-plus */
    font-family: 'bootstrap-icons';
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.cart-item-image:hover::after {
    opacity: 1;
    background: var(--secondary-color, #6c757d);
}

.no-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 64px;
}

/* Cart Item Details */
.cart-item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.cart-item-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-title-color);
    margin: 0;
}

.cart-item-spec {
    font-size: 1.1rem;
    color: #6c757d;
    margin: 0;
}

.cart-item-design {
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 4px 0;
}

.cart-item-option {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 1px 0;
    line-height: 1.4;
}

.cart-item-design i,
.cart-item-option i {
    margin-right: 6px;
    color: #888;
}

.cart-item-unit-price {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin: 10px 0 0 0;
}

/* Edit Button - Secondary style */
.btn-edit-design {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--secondary-color, #6c757d);
    border: 1px solid var(--secondary-color, #6c757d);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-top: 15px;
    width: fit-content;
}

.btn-edit-design:hover {
    background: var(--secondary-hover-color, #545b62);
    border-color: var(--secondary-hover-color, #545b62);
    color: #fff;
    text-decoration: none;
}

/* Cart Item Footer (quantity, subtotal) */
.cart-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* Quantity Controls */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.qty-controls {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    color: #333;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.qty-btn:active {
    background: #dee2e6;
}

.qty-input {
    width: 80px;
    height: 36px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
    background: #fff;
}

/* Subtotal */
.cart-item-subtotal {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: right;
}

.subtotal-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.subtotal-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-title-color);
}

/* Remove Button - Top Right Corner */
.cart-item-actions {
    position: absolute;
    top: 15px;
    right: 15px;
}

.btn-remove {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #fee2e2;
    border-color: var(--danger-button-color, #dc3545);
    color: var(--danger-button-color, #dc3545);
}

/* Continue Shopping */
.continue-shopping {
    margin-top: 20px;
}

/* Cart Summary */
.cart-summary {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 25px;
    position: sticky;
    top: 100px;
}

.summary-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-title-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 0.95rem;
}

.summary-line span:first-child {
    color: #6c757d;
}

.free-shipping-notice {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.free-shipping-notice i {
    font-size: 16px;
}

.summary-divider {
    height: 1px;
    background: #eee;
    margin: 15px 0;
}

.summary-total {
    font-size: 1.1rem;
    font-weight: 600;
}

.summary-total span:first-child {
    color: var(--text-title-color);
}

.summary-total-amount {
    font-size: 1.3rem;
    color: var(--primary-color);
}

/* Trust Badges */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #888;
    font-size: 0.8rem;
}

.badge-item i {
    font-size: 24px;
    color: var(--primary-color);
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .cart-summary {
        position: static;
        margin-top: 30px;
    }

    .cart-item-body {
        grid-template-columns: 160px 1fr;
        gap: 20px;
    }

    .cart-item-image {
        width: 160px;
        height: 160px;
    }

    .cart-item-image img {
        max-width: 140px;
        max-height: 140px;
    }
}

@media (max-width: 768px) {
    .cart-item-body {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .cart-item-image {
        width: 100%;
        height: auto;
        max-width: none;
        margin: 0;
    }

    .cart-item-image img {
        max-width: 100%;
        max-height: none;
        width: 100%;
        height: auto;
    }

    .cart-item-details {
        grid-column: 1;
        grid-row: 2;
    }

    .cart-item-footer {
        flex-wrap: wrap;
        gap: 15px;
    }

    .cart-item-actions {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .cart-item-header .cart-item-name {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.5rem;
    }

    .cart-item {
        padding: 20px;
    }


    .cart-item-header .cart-item-name {
        font-size: 1rem;
    }

    .cart-item-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-subtotal {
        width: 100%;
        justify-content: space-between;
    }

    .trust-badges {
        flex-direction: column;
        gap: 10px;
    }

    .badge-item {
        flex-direction: row;
    }
}

/* =====================================================
   Design Lightbox
   Full-screen preview modal for design thumbnails
   ===================================================== */

.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    line-height: 1;
    z-index: 10000;
}

.image-lightbox-close:hover {
    opacity: 1;
}

/* Mobile adjustments for lightbox */
@media (max-width: 768px) {
    .image-lightbox {
        padding: 20px;
    }

    .image-lightbox-close {
        top: 15px;
        right: 15px;
        font-size: 2rem;
    }
}
