/*--- IMAGE ---*/
.image_fit_width{
    width: 100%;
}

.image_avatar {
    width: 100%;
    max-width: 200px;
    border-radius: 50%;
    object-fit: cover;
}

.image_gallery{
    border: 1px solid grey;
    border-radius: 10px;
}

.image_wrapper {
    position: relative;
    display: inline-block;
}

.image_badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 60px;
    height: 60px;
}


/* Immagini di entità (Spare / Need / Mex / ecc.): il file mantiene sempre
   il proprio aspect ratio. I contenitori stabilizzano il layout senza crop. */
.image_entity_card,
.image_entity_small,
.image_entity_detail,
.image_entity_icon {
    display: block;
    width: 100%;
    object-fit: contain;
    object-position: center;
    background: #f3f3f3;
}

.image_entity_card {
    aspect-ratio: 4 / 3;
    border-radius: 6px;
}

.image_entity_small {
    aspect-ratio: 4 / 3;
    border-radius: 6px;
}

.image_entity_detail {
    max-height: min(70vh, 900px);
    border-radius: 5px;
}

.image_entity_icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
}

.image_gallery.image_entity_small {
    border-radius: 10px;
}

/*--- POSITIONS - Mobile ---*/
@media (max-width: 991px) {
    .image_badge {
        right: 5px;
        width: 30px;
        height: 30px;
    }
}
/* Uploader media */
.media-uploader-card {
	margin: 8px 0;
	padding: 10px;
	border: 1px solid #d8dee4;
	border-radius: 10px;
	background: #fff;
	text-align: left;
}

.media-uploader-header {
	display: flex;
	align-items: center;
	min-height: 28px;
	margin-bottom: 8px;
}

.media-uploader-header label {
	margin: 0;
	font-weight: 600;
}

.media-uploader-count {
	margin-left: auto;
	font-size: 13px;
	font-weight: 600;
	color: #626b73;
	white-space: nowrap;
}

.media-preview-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
	gap: 8px;
	margin: 0 0 8px;
}

.media-preview-grid[hidden],
.media-pending-attachments[hidden] {
	display: none;
}

.media-preview-item {
	position: relative;
	aspect-ratio: 4 / 3;
	min-width: 0;
	border: 1px solid #d8dee4;
	border-radius: 8px;
	overflow: hidden;
	background: #f6f7f8;
}

.media-preview-item img {
	display: block;
	width: 100%;
	height: 100%;
	padding: 4px;
	object-fit: contain;
	image-orientation: from-image;
}

.media-preview-item .js-media-delete-existing,
.media-preview-item .js-media-delete-pending,
.media-preview-item .js-media-cancel-upload {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	background: rgba(255, 255, 255, 0.94);
}

.media-existing-replaced {
	display: none;
}

/* Le immagini già salvate non vengono cancellate al click: il click prepara
   l'eliminazione per il prossimo Salva e un secondo click la annulla. */
.media-existing-deleted img {
	opacity: 0.3;
}

.media-existing-deleted::before {
	content: "Da eliminare";
	position: absolute;
	left: 6px;
	bottom: 6px;
	z-index: 2;
	padding: 3px 7px;
	border: 1px solid #b42318;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.96);
	color: #b42318;
	font-size: 12px;
	line-height: 1.2;
}

.media-pending-image,
.media-uploading-image {
	border-style: dashed;
	border-color: #8a949e;
}

.media-uploading-image img {
	opacity: 0.72;
}

.media-pending-badge,
.media-uploading-badge {
	position: absolute;
	left: 6px;
	bottom: 6px;
	padding: 3px 7px;
	border: 1px solid #9aa3ab;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.94);
	font-size: 12px;
	line-height: 1.2;
}

.media-uploading-badge {
	color: #626b73;
}

.media-pending-attachments {
	display: grid;
	gap: 8px;
	margin: 0 0 10px;
}

.media-pending-attachment {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 8px 10px;
	border: 1px dashed #8a949e;
	border-radius: 8px;
	background: #f8f9fa;
}

.media-pending-attachment-icon {
	font-size: 18px;
}

.media-pending-attachment-info {
	display: flex;
	min-width: 0;
	flex-direction: column;
}

.media-pending-attachment-info strong,
.media-pending-attachment-info small {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.media-pending-attachment-info small {
	margin-top: 2px;
	color: #626b73;
}

.media-pending-attachment .js-media-delete-pending,
.media-pending-attachment .js-media-cancel-upload {
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
}

.media-uploading-attachment {
	opacity: 0.78;
}

.js-media-uploader .uppy-Dashboard-inner {
	max-width: 100%;
	height: 64px !important;
	min-height: 64px !important;
	border: 1px dashed #c5ccd3;
	border-radius: 8px;
	background: #fbfcfd;
}

.js-media-uploader .uppy-Dashboard-AddFiles {
	min-height: 60px;
	padding: 5px 10px 2px;
	border: 0;
}

.js-media-uploader .uppy-Dashboard-AddFiles-title {
	margin: 0;
	font-size: 14px;
	line-height: 1.35;
}

.js-media-uploader .uppy-Dashboard-note {
	margin-top: 2px;
	font-size: 11px;
	line-height: 1.3;
	color: #626b73;
}

.js-media-uploader .uppy-StatusBar {
	border-radius: 0 0 8px 8px;
}

/* Gli errori Uppy vengono riversati nel solo slot Reaplace sotto il picker. */
.js-media-uploader .uppy-Informer {
	display: none !important;
}

.js-media-error[data-media-message-type="status"] {
	color: #626b73;
}

.js-media-error {
	display: block;
	visibility: hidden;
	min-height: 36px;
	margin-top: 4px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 20px;
	white-space: pre-line;
	color: #b42318;
}

@media (max-width: 575px) {
	.media-uploader-card {
		padding: 10px;
	}

	.media-preview-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Gallery: supporta immagini verticali, orizzontali e panoramiche senza crop. */
.image-gallery-carousel-inner {
	padding: 0 5%;
}

.image-gallery-carousel .carousel-item {
	height: min(75vh, 900px);
}

.image-gallery-carousel-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
}
