/* ACF Gallery Carousel - Styles */

.agc-carousel-wrapper {
    position: relative;
    width: 100%;
}

.agc-carousel {
    position: relative;
    width: 100%;
}

.agc-notice {
    padding: 20px;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    text-align: center;
    color: #666;
}

/* Track e Slides */
.agc-carousel-track {
    position: relative;
    width: 100%;
    overflow: hidden;
    perspective: 1200px;
}

.agc-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    z-index: 1;
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-carousel-slide:first-child {
    position: relative;
}

.agc-carousel-slide.active {
    position: relative;
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* Image Container - Default (no fixed height) */
.agc-carousel-image {
    position: relative;
    width: 100%;
    display: block;
    line-height: 0;
}

.agc-carousel-image a {
    display: block;
    line-height: 0;
    cursor: pointer;
}

/* Default image */
.agc-carousel-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ========================
   IMAGE DISPLAY MODES
   ======================== */

/* Natural mode - container fits the image */
.agc-image-natural .agc-carousel-track {
    overflow: hidden;
}

.agc-image-natural .agc-carousel-image {
    width: auto;
    display: inline-block;
    max-width: 100%;
}

.agc-image-natural .agc-carousel-image a {
    display: block;
}

.agc-image-natural .agc-carousel-image img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
}

/* Natural alignment */
.agc-image-natural .agc-carousel-slide {
    text-align: left;
}

.agc-image-natural.agc-align-center .agc-carousel-slide {
    text-align: center;
}

.agc-image-natural.agc-align-right .agc-carousel-slide {
    text-align: right;
}

/* Cover mode - fixed height container */
.agc-image-cover .agc-carousel-image {
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.agc-image-cover .agc-carousel-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.agc-image-cover .agc-carousel-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Contain mode - fixed height, image contained */
.agc-image-contain .agc-carousel-image {
    width: 100%;
    height: 400px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.agc-image-contain .agc-carousel-image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.agc-image-contain .agc-carousel-image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ========================
   ASPECT RATIOS (only for cover/contain)
   ======================== */

.agc-image-cover.agc-ratio-square .agc-carousel-image,
.agc-image-contain.agc-ratio-square .agc-carousel-image {
    height: 0;
    padding-bottom: 100%;
}

.agc-image-cover.agc-ratio-4-3 .agc-carousel-image,
.agc-image-contain.agc-ratio-4-3 .agc-carousel-image {
    height: 0;
    padding-bottom: 75%;
}

.agc-image-cover.agc-ratio-16-9 .agc-carousel-image,
.agc-image-contain.agc-ratio-16-9 .agc-carousel-image {
    height: 0;
    padding-bottom: 56.25%;
}

.agc-image-cover.agc-ratio-21-9 .agc-carousel-image,
.agc-image-contain.agc-ratio-21-9 .agc-carousel-image {
    height: 0;
    padding-bottom: 42.85%;
}

.agc-image-cover.agc-ratio-3-4 .agc-carousel-image,
.agc-image-contain.agc-ratio-3-4 .agc-carousel-image {
    height: 0;
    padding-bottom: 133.33%;
}

.agc-image-cover.agc-ratio-9-16 .agc-carousel-image,
.agc-image-contain.agc-ratio-9-16 .agc-carousel-image {
    height: 0;
    padding-bottom: 177.77%;
}

/* Fix for aspect ratio containers */
.agc-image-cover.agc-ratio-square .agc-carousel-image img,
.agc-image-cover.agc-ratio-4-3 .agc-carousel-image img,
.agc-image-cover.agc-ratio-16-9 .agc-carousel-image img,
.agc-image-cover.agc-ratio-21-9 .agc-carousel-image img,
.agc-image-cover.agc-ratio-3-4 .agc-carousel-image img,
.agc-image-cover.agc-ratio-9-16 .agc-carousel-image img,
.agc-image-contain.agc-ratio-square .agc-carousel-image img,
.agc-image-contain.agc-ratio-4-3 .agc-carousel-image img,
.agc-image-contain.agc-ratio-16-9 .agc-carousel-image img,
.agc-image-contain.agc-ratio-21-9 .agc-carousel-image img,
.agc-image-contain.agc-ratio-3-4 .agc-carousel-image img,
.agc-image-contain.agc-ratio-9-16 .agc-carousel-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.agc-image-cover.agc-ratio-square .agc-carousel-image img,
.agc-image-cover.agc-ratio-4-3 .agc-carousel-image img,
.agc-image-cover.agc-ratio-16-9 .agc-carousel-image img,
.agc-image-cover.agc-ratio-21-9 .agc-carousel-image img,
.agc-image-cover.agc-ratio-3-4 .agc-carousel-image img,
.agc-image-cover.agc-ratio-9-16 .agc-carousel-image img {
    width: 100%;
    height: 100%;
}

.agc-image-contain.agc-ratio-square .agc-carousel-image img,
.agc-image-contain.agc-ratio-4-3 .agc-carousel-image img,
.agc-image-contain.agc-ratio-16-9 .agc-carousel-image img,
.agc-image-contain.agc-ratio-21-9 .agc-carousel-image img,
.agc-image-contain.agc-ratio-3-4 .agc-carousel-image img,
.agc-image-contain.agc-ratio-9-16 .agc-carousel-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.agc-image-cover.agc-ratio-square .agc-carousel-image a,
.agc-image-cover.agc-ratio-4-3 .agc-carousel-image a,
.agc-image-cover.agc-ratio-16-9 .agc-carousel-image a,
.agc-image-cover.agc-ratio-21-9 .agc-carousel-image a,
.agc-image-cover.agc-ratio-3-4 .agc-carousel-image a,
.agc-image-cover.agc-ratio-9-16 .agc-carousel-image a,
.agc-image-contain.agc-ratio-square .agc-carousel-image a,
.agc-image-contain.agc-ratio-4-3 .agc-carousel-image a,
.agc-image-contain.agc-ratio-16-9 .agc-carousel-image a,
.agc-image-contain.agc-ratio-21-9 .agc-carousel-image a,
.agc-image-contain.agc-ratio-3-4 .agc-carousel-image a,
.agc-image-contain.agc-ratio-9-16 .agc-carousel-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================
   TRANSITION EFFECTS
   ======================== */

/* Fade Effect (default) */
.agc-effect-fade .agc-carousel-slide {
    transition-property: opacity, visibility;
    transition-timing-function: ease;
}

/* Slide Effect */
.agc-effect-slide .agc-carousel-slide {
    transform: translateX(100%);
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-effect-slide .agc-carousel-slide.active {
    transform: translateX(0);
}

.agc-effect-slide .agc-carousel-slide.slide-out-left {
    transform: translateX(-100%);
    opacity: 0;
}

.agc-effect-slide .agc-carousel-slide.slide-out-right {
    transform: translateX(100%);
    opacity: 0;
}

/* Slide Up Effect */
.agc-effect-slide-up .agc-carousel-slide {
    transform: translateY(50px);
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-effect-slide-up .agc-carousel-slide.active {
    transform: translateY(0);
}

/* Zoom Effect */
.agc-effect-zoom .agc-carousel-slide {
    transform: scale(0.9);
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-effect-zoom .agc-carousel-slide.active {
    transform: scale(1);
}

/* Zoom + Rotate Effect */
.agc-effect-zoom-rotate .agc-carousel-slide {
    transform: scale(0.9) rotate(-3deg);
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-effect-zoom-rotate .agc-carousel-slide.active {
    transform: scale(1) rotate(0deg);
}

/* Flip Effect */
.agc-effect-flip .agc-carousel-track {
    perspective: 1200px;
}

.agc-effect-flip .agc-carousel-slide {
    transform: rotateY(-90deg);
    transform-origin: center center;
    backface-visibility: hidden;
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-effect-flip .agc-carousel-slide.active {
    transform: rotateY(0deg);
}

/* Cube Effect */
.agc-effect-cube .agc-carousel-track {
    perspective: 1200px;
    transform-style: preserve-3d;
}

.agc-effect-cube .agc-carousel-slide {
    transform: rotateY(-90deg);
    transform-origin: center center;
    backface-visibility: hidden;
    transition-property: transform, opacity, visibility;
    transition-timing-function: ease;
}

.agc-effect-cube .agc-carousel-slide.active {
    transform: rotateY(0deg);
}

/* ========================
   ARROWS
   ======================== */

/* Frecce - Base */
.agc-arrow {
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.agc-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.agc-arrow svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    color: #ffffff;
}

.agc-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Frecce nude (solo SVG, niente sfondo) */
.agc-arrow.agc-arrow-naked {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.agc-arrow.agc-arrow-naked:hover {
    background: none !important;
    opacity: 0.7;
}

.agc-arrow.agc-arrow-naked svg {
    width: 100%;
    height: 100%;
}

/* Frecce - Posizione ai lati (on wrapper) */
.agc-wrapper-arrows-sides .agc-arrow-prev {
    left: 10px;
    top: 50%;
    margin-top: -20px; /* metà dell'altezza della freccia */
}

.agc-wrapper-arrows-sides .agc-arrow-next {
    right: 10px;
    top: 50%;
    margin-top: -20px; /* metà dell'altezza della freccia */
}

/* Frecce - Wrapper per posizioni raggruppate */
.agc-arrows-wrapper {
    position: absolute;
    z-index: 10;
    display: flex;
    gap: 10px;
}

/* Frecce - In basso centrate */
.agc-wrapper-arrows-bottom .agc-arrows-wrapper {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

/* Frecce - In basso a sinistra */
.agc-wrapper-arrows-bottom-left .agc-arrows-wrapper {
    bottom: 10px;
    left: 10px;
}

/* Frecce - In basso a destra */
.agc-wrapper-arrows-bottom-right .agc-arrows-wrapper {
    bottom: 10px;
    right: 10px;
}

/* Frecce - In alto a sinistra */
.agc-wrapper-arrows-top-left .agc-arrows-wrapper {
    top: 10px;
    left: 10px;
}

/* Frecce - In alto a destra */
.agc-wrapper-arrows-top-right .agc-arrows-wrapper {
    top: 10px;
    right: 10px;
}

/* Frecce - Posizione personalizzata */
.agc-wrapper-arrows-custom .agc-arrow-prev,
.agc-wrapper-arrows-custom .agc-arrow-next {
    position: absolute;
}

/* Frecce raggruppate - Reset transform per posizione relativa */
.agc-arrows-wrapper .agc-arrow {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
}

/* Dots */
.agc-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.agc-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.agc-dot:hover,
.agc-dot.active {
    background-color: #ffffff;
}

/* Contatore */
.agc-counter {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 5px 15px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    font-size: 14px;
    border-radius: 4px;
    z-index: 10;
}

/* ========================
   LIGHTBOX CUSTOM
   ======================== */

.agc-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.agc-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.agc-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.agc-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.agc-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 30px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.agc-lightbox-close:hover {
    opacity: 0.7;
}

.agc-lightbox-prev,
.agc-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agc-lightbox-prev:hover,
.agc-lightbox-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.agc-lightbox-prev {
    left: -70px;
}

.agc-lightbox-next {
    right: -70px;
}

.agc-lightbox-prev svg,
.agc-lightbox-next svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.agc-lightbox-image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
}

.agc-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.agc-lightbox-caption {
    text-align: center;
    color: #ffffff;
    padding: 15px 0;
    font-size: 14px;
}

/* ========================
   RESPONSIVE
   ======================== */

@media (max-width: 768px) {
    .agc-lightbox-prev,
    .agc-lightbox-next {
        width: 40px;
        height: 40px;
    }
    
    .agc-lightbox-prev {
        left: 10px;
    }
    
    .agc-lightbox-next {
        right: 10px;
    }
    
    .agc-arrow {
        width: 35px;
        height: 35px;
    }
    
    .agc-arrow svg {
        width: 16px;
        height: 16px;
    }
}

/* Animazioni */
@keyframes agc-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.agc-lightbox.active {
    animation: agc-fade-in 0.3s ease;
}
