/**
 * Shared Product Card Styles
 *
 * Reusable card component used by:
 * - Marketplace imagelet cards (category picker)
 * - Imagelet sleeve cards (Elementor widget)
 *
 * @package Imagelet_Product_Types
 */

/* Card */
.ipt-product-card {
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.ipt-product-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    text-decoration: none;
}

.ipt-product-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ipt-product-card-link:hover {
    text-decoration: none;
}

/* Thumbnail */
.ipt-product-card-thumbnail {
    position: relative;
    aspect-ratio: 1 / 1;
    background-color: #f5f5f5;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Canvas */
.ipt-product-card-canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: none; /* Hidden until rendered by JavaScript */
    transition: transform 0.4s ease;
}

/* Fallback image */
.ipt-product-card-fallback-img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Thumbnail image (for non-canvas cards) */
.ipt-product-card-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loading spinner overlay */
.ipt-product-card-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
}

.ipt-product-card-loading .ipt-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #333;
    border-radius: 50%;
    animation: ipt-product-card-spin 0.8s linear infinite;
}

@keyframes ipt-product-card-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Info section */
.ipt-product-card-info {
    padding: 15px 10px;
    text-align: center;
}

.ipt-product-card-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ipt-product-card-price {
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

.ipt-product-card-price .woocommerce-Price-amount {
    color: #333;
    font-weight: 500;
}

.ipt-product-card-price del {
    color: #999;
    font-weight: 400;
}

.ipt-product-card-price ins {
    text-decoration: none;
    color: #333;
    font-weight: 500;
}

/* Hover zoom on thumbnail canvas/image */
.ipt-product-card-hover-zoom .ipt-product-card:hover .ipt-product-card-canvas,
.ipt-product-card-hover-zoom .ipt-product-card:hover .ipt-product-card-thumbnail img {
    transform: scale(1.05);
}

/* Placeholder (for Elementor editor preview) */
.ipt-product-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
}

.ipt-product-card-placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ccc;
}

/* Responsive */
@media (max-width: 768px) {
    .ipt-product-card-info {
        padding: 12px 8px;
    }

    .ipt-product-card-title {
        font-size: 13px;
    }

    .ipt-product-card-price {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ipt-product-card-info {
        padding: 10px 6px;
    }

    .ipt-product-card-title {
        font-size: 12px;
        margin-bottom: 5px;
    }

    .ipt-product-card-price {
        font-size: 12px;
    }
}
