/**
 * Widget Allegati - Stili
 */

/* ============================================
   RESET STILI ELEMENTOR TABS
   ============================================ */
.elementor-widget-stan-allegati .elementor-tabs-wrapper {
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.elementor-widget-stan-allegati .elementor-tab-desktop-title {
    border: 1px solid #e0e0e0;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ============================================
   ICONE TABS - FORZARE VISIBILITÀ
   ============================================ */

/* Icone tab normali - NERO */
.elementor-widget-stan-allegati .stan-tab-icon {
    color: #1a1a1a !important;
}

.elementor-widget-stan-allegati .stan-tab-icon i {
    color: #1a1a1a !important;
}

.elementor-widget-stan-allegati .stan-tab-icon svg {
    fill: #1a1a1a !important;
    width: 1em;
    height: 1em;
}

.elementor-widget-stan-allegati .stan-tab-icon svg path {
    fill: #1a1a1a !important;
}

/* Icone tab attive - BIANCO */
.elementor-widget-stan-allegati .elementor-tab-desktop-title.elementor-active .stan-tab-icon,
.elementor-widget-stan-allegati .elementor-tab-desktop-title.elementor-active .stan-tab-icon i {
    color: #ffffff !important;
}

.elementor-widget-stan-allegati .elementor-tab-desktop-title.elementor-active .stan-tab-icon svg,
.elementor-widget-stan-allegati .elementor-tab-desktop-title.elementor-active .stan-tab-icon svg path {
    fill: #ffffff !important;
}

/* Icone tab hover - BIANCO */
.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover .stan-tab-icon,
.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover .stan-tab-icon i {
    color: #ffffff !important;
}

.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover .stan-tab-icon svg,
.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover .stan-tab-icon svg path {
    fill: #ffffff !important;
}

.elementor-widget-stan-allegati .elementor-tab-desktop-title.elementor-active {
    border-color: #D92A25;
    background-color: #D92A25;
    color: #ffffff;
}

.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover {
    background-color: #D92A25;
    border-color: #D92A25;
    color: #ffffff;
}

.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover i,
.elementor-widget-stan-allegati .elementor-tab-desktop-title:not(.elementor-active):hover svg {
    color: #ffffff;
    fill: #ffffff;
}

.elementor-widget-stan-allegati .stan-tab-icon {
    display: inline-flex;
    align-items: center;
}

.elementor-widget-stan-allegati .stan-tab-text {
    white-space: nowrap;
}

/* ============================================
   CONTENUTO TABS
   ============================================ */
.elementor-widget-stan-allegati .elementor-tab-content {
    border: none;
    padding: 5px 0 0 0;
    overflow: visible !important;
}

.elementor-widget-stan-allegati .elementor-tab-content:not(.elementor-active) {
    display: none;
}

/* ============================================
   GALLERIA - STILI COMUNI
   ============================================ */
.stan-gallery-grid,
.stan-gallery-slideshow {
    width: 100%;
}

.stan-gallery-grid .elementor-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.stan-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.stan-gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
}

.stan-gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: inherit;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.stan-gallery-item:hover img {
    transform: scale(1.05);
    opacity: 0.9;
}

/* ============================================
   GALLERIA - MASONRY
   ============================================ */
.stan-gallery-masonry .elementor-grid {
    display: grid;
    grid-auto-rows: 10px;
}

.stan-gallery-masonry .stan-gallery-item:nth-child(3n+1) {
    grid-row-end: span 25;
}

.stan-gallery-masonry .stan-gallery-item:nth-child(3n+2) {
    grid-row-end: span 20;
}

.stan-gallery-masonry .stan-gallery-item:nth-child(3n) {
    grid-row-end: span 22;
}

.stan-gallery-masonry .stan-gallery-item img {
    height: 100%;
}

/* ============================================
   GALLERIA - SLIDESHOW (Swiper)
   ============================================ */
.stan-gallery-slideshow {
    position: relative;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.stan-gallery-slideshow .swiper-wrapper {
    display: flex;
    align-items: stretch;
    max-width: 100%;
}

.stan-gallery-slideshow .swiper-slide {
    height: auto;
    flex-shrink: 0;
    box-sizing: border-box;
}

.stan-gallery-slideshow .stan-gallery-item {
    height: 100%;
}

.stan-gallery-slideshow .stan-gallery-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

/* Forza il contenitore a rispettare i margini */
.elementor-widget-stan-allegati {
    overflow: hidden !important;
    max-width: 100% !important;
}

.elementor-widget-stan-allegati .elementor-widget-container {
    overflow: hidden !important;
    max-width: 100% !important;
}

.elementor-widget-stan-allegati .elementor-tabs {
    overflow: hidden !important;
    max-width: 100% !important;
}

.elementor-widget-stan-allegati .elementor-tab-content {
    overflow: hidden !important;
    max-width: 100% !important;
}

/* Fallback se Swiper non è inizializzato */
.stan-gallery-slideshow:not(.swiper-initialized) .swiper-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stan-gallery-slideshow:not(.swiper-initialized) .swiper-slide {
    width: 100% !important;
}

/* Frecce navigazione */
.stan-gallery-slideshow .elementor-swiper-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.stan-gallery-slideshow .elementor-swiper-button:hover {
    background: #D92A25;
    color: #ffffff;
}

.stan-gallery-slideshow .elementor-swiper-button-prev {
    left: 15px;
}

.stan-gallery-slideshow .elementor-swiper-button-next {
    right: 15px;
}

.stan-gallery-slideshow .elementor-swiper-button i {
    font-size: 18px;
    color: #333;
    transition: color 0.3s ease;
}

.stan-gallery-slideshow .elementor-swiper-button:hover i {
    color: #ffffff;
}

/* Paginazione Swiper */
.stan-gallery-slideshow .swiper-pagination {
    position: relative;
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.stan-gallery-slideshow .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #ccc;
    opacity: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stan-gallery-slideshow .swiper-pagination-bullet-active {
    background: #D92A25;
    transform: scale(1.2);
}

/* ============================================
   GRID PDF/ZIP
   ============================================ */
.stan-allegati-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding-top: 5px;
    overflow: visible;
}

/* ============================================
   ELEMENTI PDF
   ============================================ */
.stan-allegati-pdf-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    gap: 15px;
    min-height: 200px;
    aspect-ratio: 1 / 1;
}

.stan-allegati-pdf-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.15);
    border: 1px solid #e74c3c !important;
    position: relative;
    z-index: 2;
}

/* ============================================
   ELEMENTI ZIP
   ============================================ */
.stan-allegati-zip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    gap: 15px;
    min-height: 200px;
    aspect-ratio: 1 / 1;
}

.stan-allegati-zip-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.15);
    border: 1px solid #f39c12 !important;
    position: relative;
    z-index: 2;
}

/* ============================================
   ELEMENTI LINK
   ============================================ */
.stan-allegati-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    gap: 15px;
    min-height: 200px;
    aspect-ratio: 1 / 1;
}

.stan-allegati-link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.15);
    border: 1px solid #3498db !important;
    position: relative;
    z-index: 2;
}

.stan-allegati-link-item:hover .stan-allegati-item-title {
    color: #3498db;
}

/* ============================================
   ICONE
   ============================================ */
.stan-allegati-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stan-allegati-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   TITOLI ELEMENTI
   ============================================ */
.stan-allegati-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    word-break: break-word;
    line-height: 1.4;
}

.stan-allegati-pdf-item:hover .stan-allegati-item-title {
    color: #e74c3c;
}

.stan-allegati-zip-item:hover .stan-allegati-item-title {
    color: #f39c12;
}

/* ============================================
   MOBILE TABS
   ============================================ */
.elementor-widget-stan-allegati .elementor-tab-mobile-title {
    display: none;
    padding: 12px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    margin-bottom: 5px;
    cursor: pointer;
    align-items: center;
    gap: 8px;
}

.elementor-widget-stan-allegati .elementor-tab-mobile-title.elementor-active {
    background: #D92A25;
    color: #ffffff;
    border-color: #D92A25;
}

.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active):hover {
    background: #D92A25;
    color: #ffffff;
    border-color: #D92A25;
}

/* Icone mobile normali - NERO */
.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active) .stan-tab-icon,
.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active) .stan-tab-icon i {
    color: #1a1a1a !important;
}

.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active) .stan-tab-icon svg,
.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active) .stan-tab-icon svg path {
    fill: #1a1a1a !important;
}

/* Icone mobile attive - BIANCO */
.elementor-widget-stan-allegati .elementor-tab-mobile-title.elementor-active .stan-tab-icon,
.elementor-widget-stan-allegati .elementor-tab-mobile-title.elementor-active .stan-tab-icon i {
    color: #ffffff !important;
}

.elementor-widget-stan-allegati .elementor-tab-mobile-title.elementor-active .stan-tab-icon svg,
.elementor-widget-stan-allegati .elementor-tab-mobile-title.elementor-active .stan-tab-icon svg path {
    fill: #ffffff !important;
}

/* Icone mobile hover - BIANCO */
.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active):hover .stan-tab-icon,
.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active):hover .stan-tab-icon i {
    color: #ffffff !important;
}

.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active):hover .stan-tab-icon svg,
.elementor-widget-stan-allegati .elementor-tab-mobile-title:not(.elementor-active):hover .stan-tab-icon svg path {
    fill: #ffffff !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stan-gallery-grid .elementor-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stan-allegati-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .elementor-widget-stan-allegati .elementor-tabs-wrapper {
        display: none;
    }
    
    .elementor-widget-stan-allegati .elementor-tab-mobile-title {
        display: flex;
    }

    .stan-gallery-grid .elementor-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stan-gallery-item img {
        height: 150px;
    }

    .stan-gallery-slideshow .stan-gallery-item img {
        height: 200px;
    }

    .stan-allegati-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stan-allegati-pdf-item,
    .stan-allegati-zip-item,
    .stan-allegati-link-item {
        padding: 20px 15px;
        min-height: 150px;
    }

    .stan-allegati-icon {
        width: 60px;
        height: 60px;
    }

    .stan-allegati-item-title {
        font-size: 13px;
    }

    .stan-gallery-slideshow .elementor-swiper-button {
        width: 36px;
        height: 36px;
    }
    
    .stan-gallery-slideshow .elementor-swiper-button i {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .stan-gallery-grid .elementor-grid {
        grid-template-columns: 1fr;
    }
    
    .stan-allegati-grid {
        grid-template-columns: 1fr;
    }
}
