/*
 * Стили изображений товаров — AltAurum Shop
 *
 * Принцип: сохраняем оригинальные пропорции изображений,
 * object-fit: contain — изображение целиком вписывается в контейнер.
 * JS (productImageFit) подгоняет высоту контейнера под реальные пропорции.
 */

/* ===== Контейнер изображения в карточке товара ===== */
.product-card .product-img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card .product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img-wrap img {
    transform: scale(1.03);
}

/* ===== Галерея товара (страница товара) ===== */
.product-gallery {
    user-select: none;
}

/* Область главного изображения */
.product-gallery__main {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f8f9fa;
}

.product-main-image-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

.product-main-image-wrap img.product-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

/* Стрелки влево / вправо */
.product-gallery__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s, background 0.2s;
}

.product-gallery__main:hover .product-gallery__arrow {
    opacity: 1;
}

/* На мобильных стрелки видны всегда (нет hover) */
@media (hover: none) {
    .product-gallery__arrow {
        opacity: 0.85;
    }
}

.product-gallery__arrow:hover {
    background: rgba(255,255,255,1);
}

.product-gallery__arrow:active {
    transform: translateY(-50%) scale(0.92);
}

.product-gallery__arrow--prev {
    left: 10px;
}

.product-gallery__arrow--next {
    right: 10px;
}

/* Счётчик «1 / 5» */
.product-gallery__counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 3;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 13px;
    padding: 2px 10px;
    border-radius: 12px;
    pointer-events: none;
}

/* Полоска миниатюр */
.product-gallery__thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Скрываем скроллбар на десктопе, оставляем функциональность */
.product-gallery__thumbs::-webkit-scrollbar {
    height: 4px;
}
.product-gallery__thumbs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.product-gallery__thumb-item {
    flex: 0 0 72px;
    width: 72px;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 0.375rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery__thumb-item:hover {
    border-color: #adb5bd;
}

.product-gallery__thumb-item.active {
    border-color: #198754;
}

.product-gallery__thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Старые классы (обратная совместимость — другие страницы) ===== */
.product-gallery-thumb {
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0.375rem;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.product-gallery-thumb:hover,
.product-gallery-thumb.active {
    border-color: #198754;
}

.product-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Мини-превью товаров (корзина, заказы, списки) ===== */
.product-thumb-mini {
    width: 50px;
    min-width: 50px;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-thumb-mini img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-thumb-mini--sm {
    width: 40px;
    min-width: 40px;
}

/* ===== Админка: превью в списке товаров ===== */
.product-thumb-admin {
    width: 50px;
    min-width: 50px;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-thumb-admin img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Админка: изображение на странице просмотра товара ===== */
.admin-product-image-wrap {
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

.admin-product-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Админка: галерея миниатюр ===== */
.admin-gallery-thumb {
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

.admin-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Админка: превью основного изображения в форме ===== */
.admin-form-preview {
    max-width: 200px;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-form-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Админка: галерея в форме ===== */
.admin-form-gallery-thumb {
    width: 100%;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-form-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}


