/* --- ADMIN STYLES --- */
#galleria-image-list {
    list-style: none;
    margin: 0;
    padding: 10px;
    background: #f0f0f1;
    border: 1px solid #ccc;
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.galleria-image-item {
    position: relative;
    width: 100px;
    height: 100px;
    background: #fff;
    border: 1px solid #ddd;
    padding: 4px;
    cursor: move;
}

.galleria-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.galleria-image-item .remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #d63638;
    color: #fff;
    text-decoration: none;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

.galleria-image-item .remove-image:hover {
    background: #b32d2e;
}

.ui-state-highlight {
    width: 100px;
    height: 100px;
    background: #fffae0;
    border: 1px dashed #ccc;
}

#gallery-count-info {
    margin-left: 10px;
    font-style: italic;
    color: #666;
}

/* --- FRONTEND STYLES --- */
.custom-gallery-wrapper {
    margin: 40px 0;
}

/* Layout 1: Grid (Square) */
.gallery-layout-grid .custom-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}
.gallery-layout-grid .gallery-item {
    aspect-ratio: 1/1;
}

/* Layout 2: Masonry */
.gallery-layout-masonry .custom-gallery-grid {
    column-count: 3;
    column-gap: 15px;
}
.gallery-layout-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 15px;
    aspect-ratio: auto; /* Altezze variabili */
}
.gallery-layout-masonry .gallery-item img {
    height: auto;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

@media (max-width: 992px) {
    .gallery-layout-masonry .custom-gallery-grid { column-count: 2; }
    .gallery-layout-justified .gallery-item { height: 200px; }
}

@media (max-width: 600px) {
    .gallery-layout-grid .custom-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .gallery-layout-masonry .custom-gallery-grid { column-count: 1; }
    .gallery-layout-justified .gallery-item { height: 150px; }
}

/* Fix visibilità controlli GLightbox */
.glightbox-container .gclose, 
.glightbox-container .gnext, 
.glightbox-container .gprev {
    background-color: rgba(0, 0, 0, 0.5) !important;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.glightbox-container .gclose:hover, 
.glightbox-container .gnext:hover, 
.glightbox-container .gprev:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
}