/* Contenitore e Allineamento Generale */
.mgjs-container {
    max-width: 700px;
    margin-top: 24px;
    margin-bottom: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mgjs-container.align-center {
    margin-left: auto;
    margin-right: auto;
}

.mgjs-container.align-left {
    margin-left: 0;
    margin-right: auto;
}

.mgjs-container.align-right {
    margin-left: auto;
    margin-right: 0;
}

/* BOX PRINCIPALE CON BORDO E HIGHLIGHT VISIVO */
.mgjs-box {
    /* Bordo ben visibile da 2px (puoi portarlo a 3px per un impatto ancora maggiore) */
    border: 2px solid #2c3e50; 
    border-radius: 8px;
    background: #ffffff;
    padding: 14px;
    /* Ombra soft per staccare il box dallo sfondo del sito */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 
    margin-bottom: 14px;
    transition: border-color 0.3s ease;
}

/* Visore Immagine Principale */
.mgjs-viewport {
    position: relative;
    width: 100%;
    height: 400px;
    background: #f8fafc; /* Sfondo leggermente grigio per dare stacco se le immagini sono trasparenti o verticali */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mgjs-main-image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mgjs-main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease-in-out;
}

/* Frecce trasparenti stilizzate */
.mgjs-prev, .mgjs-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.6);
    color: #2c3e50;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
    user-select: none;
}

.mgjs-prev:hover, .mgjs-next:hover {
    background: #2c3e50;
    color: #ffffff;
}

.mgjs-prev { left: 10px; }
.mgjs-next { right: 10px; }

/* Didascalia separata da una linea sottile */
.mgjs-caption {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    font-size: 13.5px;
    color: #475569;
    line-height: 1.4;
    min-height: 18px;
    font-style: italic;
}

/* Barra Anteprime (esterna al box) */
.mgjs-thumbs-wrapper {
    overflow-x: auto;
    padding-top: 4px;
}

.mgjs-thumbs-track {
    display: flex;
    gap: 10px;
}

.mgjs-thumb-btn {
    border: 2px solid transparent;
    background: none;
    padding: 0;
    cursor: pointer;
    flex: 0 0 72px;
    height: 72px;
    box-sizing: border-box;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.mgjs-thumb-btn:hover {
    opacity: 1;
}

.mgjs-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Bordo di selezione arancione/rosso sulle anteprime */
.mgjs-thumb-btn.active {
    border-color: #e05326;
    opacity: 1;
    transform: scale(1.02);
}