/**
 * Custom Fields Elementor Pro - Main CSS
 * Version: 3.0.1
 * Author: Samuele Corrieri
 */

/* ==========================================================================
   RESET E BASE
   ========================================================================== */

.custom-gallery-pro {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
}

.custom-gallery-pro * {
    box-sizing: border-box;
}

/* ==========================================================================
   GALLERIA GRID
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
}

.gallery-grid .gallery-item-custom {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-grid .gallery-item-custom:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.gallery-grid .gallery-item-custom img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.gallery-grid .gallery-item-custom:hover img {
    transform: scale(1.05);
}

.gallery-grid .gallery-item-custom a {
    display: block;
    position: relative;
    text-decoration: none;
    border: none;
    outline: none;
}

/* ==========================================================================
   GALLERIA SLIDER (SWIPER)
   ========================================================================== */

.gallery-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.gallery-swiper {
    width: 100%;
    padding-bottom: 50px; /* Spazio per i pallini */
}

.gallery-swiper .swiper-slide {
    height: auto;
}

.gallery-swiper .gallery-item-custom {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.gallery-swiper .gallery-item-custom:hover {
    transform: translateY(-5px);
}

.gallery-swiper .gallery-item-custom img {
    width: 100%;
    height: 250px;
    object-fit: contain !important;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.gallery-swiper .gallery-item-custom:hover img {
    transform: scale(1.05);
}

.gallery-swiper .gallery-item-custom a {
    display: block;
    position: relative;
    text-decoration: none;
}

/* ==========================================================================
   NAVIGAZIONE SWIPER - FRECCE
   ========================================================================== */

.custom-gallery-pro .swiper-button-next,
.custom-gallery-pro .swiper-button-prev {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    color: #ffffff;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.custom-gallery-pro .swiper-button-next:hover,
.custom-gallery-pro .swiper-button-prev:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.custom-gallery-pro .swiper-button-next:after,
.custom-gallery-pro .swiper-button-prev:after {
    font-size: 16px;
    font-weight: bold;
}

.custom-gallery-pro .swiper-button-next {
    right: 10px;
}

.custom-gallery-pro .swiper-button-prev {
    left: 10px;
}

/* ==========================================================================
   NAVIGAZIONE SWIPER - PALLINI
   ========================================================================== */

.custom-gallery-pro .swiper-pagination {
    bottom: 10px;
    text-align: center;
}

.custom-gallery-pro .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background-color: #cccccc;
    border-radius: 50%;
    opacity: 0.7;
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 0 4px;
}

.custom-gallery-pro .swiper-pagination-bullet:hover {
    opacity: 1;
    transform: scale(1.2);
}

.custom-gallery-pro .swiper-pagination-bullet-active {
    background-color: #007cba;
    opacity: 1;
    transform: scale(1.3);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gallery-grid .gallery-item-custom img,
    .gallery-swiper .gallery-item-custom img {
        height: 200px;
    }

    .custom-gallery-pro .swiper-button-next,
    .custom-gallery-pro .swiper-button-prev {
        width: 35px;
        height: 35px;
        margin-top: -17.5px;
    }

    .custom-gallery-pro .swiper-button-next:after,
    .custom-gallery-pro .swiper-button-prev:after {
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gallery-grid .gallery-item-custom img,
    .gallery-swiper .gallery-item-custom img {
        height: 180px;
    }

    .custom-gallery-pro .swiper-button-next,
    .custom-gallery-pro .swiper-button-prev {
        width: 30px;
        height: 30px;
        margin-top: -15px;
    }

    .custom-gallery-pro .swiper-button-next:after,
    .custom-gallery-pro .swiper-button-prev:after {
        font-size: 12px;
    }

    .custom-gallery-pro .swiper-pagination-bullet {
        width: 8px;
        height: 8px;
        margin: 0 3px;
    }

    .gallery-swiper {
        padding-bottom: 40px;
    }
}

/* Mobile piccolo */
@media (max-width: 480px) {
    .gallery-grid .gallery-item-custom img,
    .gallery-swiper .gallery-item-custom img {
        height: 160px;
    }

    .gallery-grid {
        gap: 8px;
    }
}

/* ==========================================================================
   FALLBACK E PLACEHOLDER
   ========================================================================== */

.custom-gallery-fallback {
    padding: 20px;
    text-align: center;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    font-style: italic;
}

/* ==========================================================================
   STILI PER ALTRI WIDGET (TITOLI, TESTI, ETC.)
   ========================================================================== */

/* Widget Titoli */
.custom-titolo-parte-1,
.custom-titolo-2,
.custom-titolo-3,
.custom-titolo-4,
.custom-titolo-5 {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

/* Widget Testi */
.custom-testo-parte-1,
.custom-testo-3-prima-galleria,
.custom-testo-4,
.custom-elenco-puntato-1 {
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.custom-testo-parte-1 p,
.custom-testo-3-prima-galleria p,
.custom-testo-4 p,
.custom-elenco-puntato-1 p {
    margin-bottom: 1em;
}

.custom-testo-parte-1 p:last-child,
.custom-testo-3-prima-galleria p:last-child,
.custom-testo-4 p:last-child,
.custom-elenco-puntato-1 p:last-child {
    margin-bottom: 0;
}

/* Lista puntata stili specifici */
.custom-elenco-puntato-1 ul,
.custom-elenco-puntato-1 ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.custom-elenco-puntato-1 li {
    margin-bottom: 0.5em;
}

/* ==========================================================================
   TABELLA CUSTOM
   ========================================================================== */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 0;
    padding: 0;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.custom-table th,
.custom-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.custom-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.custom-table tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.3s ease;
}

.custom-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

/* Responsive tabella */
@media (max-width: 768px) {
    .table-wrapper {
        font-size: 14px;
    }

    .custom-table th,
    .custom-table td {
        padding: 8px 10px;
    }
}

/* ==========================================================================
   FISARMONICA DOWNLOAD
   ========================================================================== */

.custom-downloads-accordion {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.custom-downloads-accordion .accordion-item {
    border-bottom: 1px solid #e0e0e0;
}

.custom-downloads-accordion .accordion-item:last-child {
    border-bottom: none;
}

.custom-downloads-accordion .accordion-item-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    transition: background-color 0.3s ease;
    list-style: none;
    margin: 0;
}

.custom-downloads-accordion .accordion-item-title:hover {
    background-color: #e9ecef;
}

.custom-downloads-accordion .accordion-item[open] > .accordion-item-title {
    background-color: #e9ecef;
}

.custom-downloads-accordion .accordion-item-content {
    padding: 15px 20px;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
}

.custom-downloads-accordion .accordion-item-content p {
    margin: 0;
}

.custom-downloads-accordion .accordion-item-content a {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.custom-downloads-accordion .accordion-item-content a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* ==========================================================================
   UTILITÀ E HELPERS
   ========================================================================== */

/* Loading animation per quando Swiper non è ancora caricato */
.gallery-swiper:not(.swiper-initialized) {
    opacity: 0.7;
}

.gallery-swiper.swiper-initialized {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Focus states per accessibilità */
.gallery-item-custom a:focus,
.custom-downloads-accordion .accordion-item-title:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .custom-gallery-pro,
    .swiper-button-next,
    .swiper-button-prev,
    .swiper-pagination {
        display: none !important;
    }

    .custom-table {
        box-shadow: none;
        border: 1px solid #000;
    }

    .custom-downloads-accordion .accordion-item-content {
        display: block !important;
    }
}

/* ==========================================================================
   COMPATIBILITÀ GLIGHTBOX
   ========================================================================== */

/* Assicura che GLightbox funzioni bene con le nostre immagini */
.gallery-item-custom a.glightbox {
    display: block;
    position: relative;
}

.gallery-item-custom a.glightbox img {
    transition: transform 0.3s ease;
}

/* Override di eventuali stili conflittuali */
.custom-gallery-pro .gallery-item-custom a {
    border: none !important;
    box-shadow: none !important;
}

.custom-gallery-pro .gallery-item-custom a:before,
.custom-gallery-pro .gallery-item-custom a:after {
    display: none !important;
}

/* ==========================================================================
   PERFORMANCE E OTTIMIZZAZIONI
   ========================================================================== */

/* GPU acceleration per le trasformazioni */
.gallery-item-custom,
.gallery-item-custom img,
.swiper-button-next,
.swiper-button-prev,
.swiper-pagination-bullet {
    will-change: transform;
    transform: translateZ(0);
}

/* Smooth scrolling per container */
.table-wrapper {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   DARK MODE SUPPORT (OPZIONALE)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .custom-table {
        background-color: #1e1e1e;
        color: #ffffff;
    }

    .custom-table th {
        background-color: #2d2d2d;
        color: #ffffff;
    }

    .custom-table tbody tr:hover {
        background-color: #2d2d2d;
    }

    .custom-downloads-accordion {
        background-color: #1e1e1e;
        border-color: #404040;
    }

    .custom-downloads-accordion .accordion-item-title {
        background-color: #2d2d2d;
        color: #ffffff;
    }

    .custom-downloads-accordion .accordion-item-content {
        background-color: #1e1e1e;
        color: #ffffff;
        border-color: #404040;
    }
}