/**
 * Sticker Designer Cart/Checkout Styles
 * Preview modal and thumbnail styling
 */

/* Cart Thumbnail */
.sticker-design-preview-link {
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.sticker-design-preview-link:hover {
    transform: scale(1.05);
}

.sticker-design-thumbnail {
    max-width: 80px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: repeating-conic-gradient(#f0f0f0 0% 25%, #ffffff 0% 50%) 50% / 10px 10px;
}

.sticker-preview-zoom-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 3px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-preview-zoom-icon svg {
    display: block;
    stroke: currentColor;
}

.sticker-design-preview-link:hover .sticker-preview-zoom-icon {
    opacity: 1;
}

/* Preview Modal */
.sticker-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-preview-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.sticker-preview-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: stickerModalFadeIn 0.3s ease;
}

@keyframes stickerModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sticker-preview-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-preview-modal-close:hover {
    background: #e94560;
    transform: scale(1.1);
}

.sticker-preview-modal-body {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
    min-width: 300px;
    min-height: 300px;
}

#sticker-preview-modal-image {
    max-width: 80vw;
    max-height: 80vh;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
}

/* Responsive */
@media (max-width: 600px) {
    .sticker-preview-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }

    .sticker-preview-modal-body {
        padding: 15px;
        min-width: 200px;
        min-height: 200px;
    }

    #sticker-preview-modal-image {
        max-width: 90vw;
        max-height: 85vh;
    }

    .sticker-preview-modal-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 8px;
        right: 8px;
    }
}

/* WooCommerce specific overrides */
.woocommerce-cart-form .sticker-design-thumbnail,
.woocommerce-checkout .sticker-design-thumbnail {
    width: 80px !important;
    height: auto !important;
}

/* Hide empty WooCommerce product links in thumbnail column */
.product-thumbnail > a:empty {
    display: none !important;
}

/* Ensure thumbnail column shows our preview properly */
.woocommerce-cart-form__cart-item .product-thumbnail {
    vertical-align: middle;
}

.woocommerce-cart-form__cart-item .product-thumbnail .sticker-design-preview-link {
    display: inline-block !important;
}

/* Order details page thumbnail */
.woocommerce-table--order-details .sticker-design-thumbnail {
    max-width: 60px;
    max-height: 60px;
}
