/* База: все img в pg-detail — вписываем целиком */
.pg-detail img,
.pg-detail picture img {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: auto !important;
    min-height: auto !important;
}

/* Гарантируем, что родительские контейнеры не обрезают контент */
.pg-detail .listing-detail-image,
.pg-detail [class*="ImageContainer"],
.pg-detail [class*="MainImage"],
.pg-detail [class*="PhotoBlock"],
.pg-detail [class*="GalleryItem"] {
    height: 100% !important;
    min-height: 100% !important;
    aspect-ratio: auto !important;
    overflow: visible !important;
    display: block !important;
}

/* Исключения: миниатюры и превью — оставляем как есть (cover) */
.pg-detail [class*="thumb"] img,
.pg-detail [class*="Thumb"] img,
.pg-detail [class*="preview"] img,
.pg-detail [class*="Preview"] img,
.pg-detail [class*="Thumbnail"] img,
.pg-detail [class*="nav"] img {
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    background: none !important;
    filter: none !important;
}

/* Лента: карточки — оставляем cover (обрезка допустима) */
.pg-feed [class*="Card"] img,
.pg-feed [class*="Grid"] img,
.pg-feed [class*="List"] img,
.pg-feed .listing-item img,
.pg-feed img[src*="/storage/"] {
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
}

/* ЛК: миниатюры — оставляем cover */
.pg-lk [class*="Upload"] img,
.pg-lk [class*="Preview"] img,
.pg-lk [class*="Thumbnail"] img,
.pg-lk div[style*="width: 80px"] img,
.pg-lk div[style*="width: 120px"] img {
    object-fit: cover !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
}


/* =========================================
   КНОПКА-КРЕСТИК ДЛЯ УДАЛЕНИЯ ФОТО (pg-create)
   ========================================= */
.pg-create [class*="Thumbnail"],
.pg-create [class*="thumb"],
.pg-create [class*="preview"] {
    position: relative !important;
    display: inline-block !important;
    overflow: visible !important;
}

.pg-create .custom-delete-btn {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #d32f2f !important;
    border: none !important;
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: bold !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3) !important;
    z-index: 20 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.pg-create .custom-delete-btn:hover {
    background-color: #ffebee !important;
    color: #c62828 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4) !important;
}
