/* Product SKU photo — preview circle + full-size lightbox */

.product-photo {
    --product-photo-size: 148px;
    position: relative;
    width: var(--product-photo-size);
    height: var(--product-photo-size);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: var(--hover-background, rgba(0, 91, 150, 0.08));
    color: var(--primary-color);
    transition: width 0.22s ease, height 0.22s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-photo.has-photo {
    --product-photo-size: 220px;
    border-color: color-mix(in srgb, var(--primary-color) 35%, var(--border-color));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
}

.product-photo.is-empty.can-manage {
    cursor: pointer;
}

.product-photo.is-empty.can-manage:hover,
.product-photo.has-photo:hover {
    border-color: var(--primary-color);
}

.product-photo.is-empty.can-manage:hover {
    background: var(--hover-background);
}

.product-photo-btn {
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: inherit;
    overflow: hidden;
}

.product-photo-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.product-photo-icon {
    font-size: 2rem;
    opacity: 0.85;
}

.product-photo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
    background: var(--card-bg-color);
}

.product-photo-btn picture {
    width: 100%;
    height: 100%;
    display: block;
}

.product-name-with-photo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.product-name-with-photo > a,
.product-name-with-photo > span:not(.product-photo-thumb) {
    min-width: 0;
}

.product-photo-thumb {
    --product-photo-thumb-size: 36px;
    width: var(--product-photo-thumb-size);
    height: var(--product-photo-thumb-size);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--hover-background, rgba(0, 91, 150, 0.08));
    color: var(--primary-color);
    overflow: hidden;
    pointer-events: none;
}

.product-photo-thumb.is-empty {
    background: var(--hover-background, rgba(0, 91, 150, 0.08));
}

.product-photo-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: var(--card-bg-color);
}

.product-photo-thumb picture {
    width: 100%;
    height: 100%;
    display: block;
}

.product-photo-thumb-icon {
    font-size: 0.85rem;
    opacity: 0.8;
}

.create-product-option .product-photo-thumb,
.dropdown-item .product-photo-thumb {
    --product-photo-thumb-size: 44px;
}

.create-product-option__header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.create-product-option__header-text {
    min-width: 0;
    flex: 1;
}


.product-photo.is-busy::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--card-bg-color) 55%, transparent);
    z-index: 1;
}

.product-photo-busy-spinner {
    position: absolute;
    inset-inline-start: 50%;
    top: 50%;
    width: 1.75rem;
    height: 1.75rem;
    margin: -0.875rem;
    border-radius: 50%;
    border: 2.5px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-top-color: var(--primary-color);
    animation: product-photo-spin 0.7s linear infinite;
    z-index: 2;
    pointer-events: none;
}

@keyframes product-photo-spin {
    to { transform: rotate(360deg); }
}

.product-photo-chooser {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 8px);
    min-width: 11.5rem;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-photo-chooser[hidden] {
    display: none;
}

.product-photo-menu-item {
    border: 0;
    background: transparent;
    color: var(--text-color);
    text-align: start;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.product-photo-menu-item:hover,
.product-photo-menu-item:focus-visible {
    background: var(--hover-background);
    color: var(--primary-color);
}

.product-photo-host {
    display: flex;
    justify-content: center;
    margin: 0 0 16px;
}

.product-photo-host[hidden] {
    display: none !important;
}

.ivcc-card-header .product-photo-host {
    margin: 0 0 8px;
}

.ivcc-card-header .product-photo.has-photo {
    --product-photo-size: 188px;
}

.ivcc-card-header:has(.product-photo) {
    min-height: auto;
}

.ivcc-card-header:has(.product-photo) .ivcc-product-title {
    min-height: calc(2 * 1.3 * clamp(1.35rem, 1.8vw, 1.85rem));
    -webkit-line-clamp: 2;
    font-size: clamp(1.35rem, 1.8vw, 1.85rem);
}

.product-details-photo-host {
    margin: 0;
}

input.product-photo-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* Full-size photo modal */
.product-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 32, 0.72);
}

.product-photo-lightbox[hidden] {
    display: none !important;
}

.product-photo-lightbox-dialog {
    position: relative;
    width: min(920px, 100%);
    max-height: min(88vh, 920px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.product-photo-lightbox-img {
    width: 100%;
    max-height: min(72vh, 780px);
    object-fit: contain;
    border-radius: 16px;
    background: var(--card-bg-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.product-photo-lightbox-img-host {
    width: 100%;
    display: flex;
    justify-content: center;
}

.product-photo-lightbox-img-host picture {
    width: 100%;
    display: block;
}

.product-photo-lightbox-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.product-photo-lightbox-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg-color);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.product-photo-lightbox-icon:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.05);
}

.product-photo-lightbox-icon.is-danger:hover {
    border-color: var(--danger-color, #c0392b);
    color: var(--danger-color, #c0392b);
}

.product-photo-lightbox-close {
    position: absolute;
    inset-block-start: -8px;
    inset-inline-end: -8px;
}

.product-photo-lightbox-dialog .product-photo-chooser {
    position: static;
    inset: auto;
    min-width: 12.5rem;
}

@media (max-width: 1100px) {
    .product-photo {
        --product-photo-size: 120px;
    }

    .product-photo.has-photo {
        --product-photo-size: 168px;
    }

    .ivcc-card-header .product-photo.has-photo {
        --product-photo-size: 148px;
    }

    .product-photo-icon {
        font-size: 1.6rem;
    }

    .product-photo-lightbox {
        padding: 16px 12px 28px;
    }

    .product-photo-lightbox-img {
        max-height: min(68vh, 640px);
        border-radius: 12px;
    }
}
