/**
 * PAFS External Images
 *
 * Styles for externally-hosted product images (hotlinked from advertiser URLs).
 *
 * @package PartnerAdsFeedSync
 * @since   1.2.0
 */

/* ------------------------------------------------------------------
 * Base external image
 * ----------------------------------------------------------------*/

.pafs-external-image {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
}

/* ------------------------------------------------------------------
 * Product grid / archive thumbnails
 * ----------------------------------------------------------------*/

.woocommerce ul.products li.product .pafs-external-image,
.woocommerce-page ul.products li.product .pafs-external-image {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
}

/* ------------------------------------------------------------------
 * Single product - main image
 * ----------------------------------------------------------------*/

.woocommerce div.product div.images .pafs-external-image,
.single-product .woocommerce-product-gallery .pafs-external-image {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    max-height: 600px;
}

/* ------------------------------------------------------------------
 * Single product - gallery thumbnail strip
 * ----------------------------------------------------------------*/

.woocommerce div.product div.images .flex-control-thumbs li .pafs-external-image,
.woocommerce-product-gallery .flex-control-thumbs li .pafs-external-image {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    cursor: pointer;
}

/* ------------------------------------------------------------------
 * Admin - product list thumbnail column
 * ----------------------------------------------------------------*/

.wp-admin .column-thumb .pafs-external-image,
.wp-admin .column-thumbnail .pafs-external-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

/* ------------------------------------------------------------------
 * Admin - metabox featured image preview
 * ----------------------------------------------------------------*/

.pafs-featured-preview .pafs-external-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

/* ------------------------------------------------------------------
 * Admin - metabox gallery grid
 * ----------------------------------------------------------------*/

.pafs-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pafs-gallery-grid .pafs-gallery-item {
    position: relative;
    width: 80px;
    height: 80px;
}

.pafs-gallery-grid .pafs-gallery-item .pafs-external-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

/* ------------------------------------------------------------------
 * Admin - gallery item remove button
 * ----------------------------------------------------------------*/

.pafs-gallery-grid .pafs-gallery-item .pafs-gallery-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d63638;
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pafs-gallery-grid .pafs-gallery-item .pafs-gallery-remove:hover {
    background: #a02224;
}

/* ------------------------------------------------------------------
 * Admin - add gallery URL button
 * ----------------------------------------------------------------*/

.pafs-gallery-grid .pafs-gallery-add {
    width: 80px;
    height: 80px;
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    background: transparent;
    color: #c3c4c7;
    font-size: 32px;
    line-height: 76px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pafs-gallery-grid .pafs-gallery-add:hover {
    border-color: #2271b1;
    color: #2271b1;
}
