/*
 * Shared image rules for the frontend, alumni/admin and super admin layouts
 * (included once via resources/views/layouts/image-assets.blade.php).
 * Kept low-specificity so existing theme rules still win where they set sizes.
 */

/* Never overflow the container on small screens. */
img {
    max-width: 100%;
}

/* Fixed-size wrappers (cards, thumbnails, avatars): fill the box without stretching. */
.overflow-hidden > img,
.overflow-hidden > a > img,
.overflow-hidden > picture > img,
.news-img,
.img > img,
.speech-img img,
.galleryImage-item img,
.postPhotoItems img,
.home-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Card/list thumbnails without a fixed-height wrapper get a consistent ratio. */
.img > img,
.news-img:not([class*=" h-"]) {
    aspect-ratio: 16 / 10;
}

/* Avatars: always round and square, never squashed. */
img.rounded-circle,
.rounded-circle.overflow-hidden > img,
.user-chat-img img,
.message-user-img img,
.profileImage-upload img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
}
.rounded-circle.overflow-hidden > img {
    width: 100%;
    height: 100%;
}

/* Logos and brand marks: show the whole image. */
.brand-logo img,
.zSidebar img.max-h-35,
.gateway-image img,
img[src*="/Setting/"] {
    object-fit: contain;
    aspect-ratio: auto;
    border-radius: 0;
}

/* Small images inside admin tables (DataTables). */
table.dataTable td img:not(.rounded-circle),
.table td img:not(.rounded-circle) {
    max-height: 3.5rem;
    width: auto;
    object-fit: cover;
    border-radius: 0.5rem;
}
table.dataTable td img.rounded-circle,
.table td .rounded-circle.overflow-hidden > img {
    width: 2.5rem;
    height: 2.5rem;
}

/* Placeholder shown by the onerror fallback for missing/broken images. */
img.img-fallback {
    object-fit: contain;
    background-color: #f2f3f5;
}
