/* File: assets/custom-swiper-widget.css */

/* Reset e Container Principale */
.custom-swiper-widget {
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.custom-swiper-widget *,
.custom-swiper-widget *::before,
.custom-swiper-widget *::after {
    box-sizing: border-box;
}

/* Container Flex */
.csw-container {
    display: flex;
    align-items: stretch;
    min-height: 500px;
    background: #ffffff;
    position: relative;
    overflow: visible;
    /* Importante per permettere alle slide di uscire */
}

/* ========================================
   SEZIONE SINISTRA (1/3)
   ======================================== */
.csw-left-section {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    display: flex;
    align-items: center;
    padding: 60px 40px;
    background: #ffffff;
    position: relative;
    z-index: 2;
}

/* Contenuto sezione sinistra */
.csw-content {
    width: 100%;
    max-width: 400px;
    position: relative;
}

.csw-main-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 25px 0;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.csw-main-description {
    font-size: 20px;
    line-height: 1.6;
    color: #202020;
    margin: 0 0 40px 0;
}

.csw-main-description p {
    margin: 0 0 15px 0;
}

.csw-main-description p:last-child {
    margin-bottom: 0;
}

/* Navigazione */
.csw-navigation {
    display: flex;
    gap: 15px;
    align-items: center;
}

.csw-prev,
.csw-next {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    background: #e0e0e0;
    color: #666;
}

.csw-prev:hover:not(.swiper-button-disabled) {
    transform: translateX(-2px);
}

.csw-next:hover:not(.swiper-button-disabled) {
    transform: translateX(2px);
}

.csw-prev.swiper-button-disabled,
.csw-next.swiper-button-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.csw-prev svg,
.csw-next svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* ========================================
   SEZIONE DESTRA (2/3) - SWIPER
   ======================================== */
.csw-right-section {
    flex: 1;
    min-width: 0;
    /* Importante per flex */
    position: relative;
    padding-left: 20px;
    /* Spazio tra le sezioni */
    overflow: visible;
    /* Importante per mostrare slide parziali */
}

/* Swiper Container */
.csw-right-section .swiper {
    width: 100%;
    height: 100%;
    overflow: visible;
    /* Permette di vedere le slide parziali */
}

.csw-right-section .swiper-wrapper {
    align-items: stretch;
}

/* Swiper Slide */
.csw-right-section .swiper-slide {
    height: auto;
    overflow: visible;
}

/* Link della slide */
.csw-slide-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    width: 100%;
}

/* Contenuto Slide */
.csw-slide-content {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Immagine Slide - Formato Reel Instagram (9:16) */
.csw-slide-image {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 24px;
    max-height: 600px; /* Previeni altezze eccessive su desktop */
}

.csw-slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.csw-slide-link:hover .csw-slide-image img {
    transform: scale(1.08);
}

/* Titolo e Descrizione Slide */
.csw-slide-title {
    padding-top: 1rem;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #202020;
    line-height: 1.3;
}

.csw-slide-description {
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    color: #666666;
}

/* ========================================
   LAYOUT SOLO SLIDE (senza contenuto principale)
   ======================================== */

.csw-layout-slides-only .csw-container {
    flex-direction: column;
    align-items: flex-start;
}

.csw-layout-slides-only .csw-left-section {
    display: none; /* Nascondi completamente la sezione sinistra */
}

.csw-layout-slides-only .csw-right-section {
    flex: 1;
    max-width: 100%;
    width: 100%;
    padding-left: 0;
}

/* Navigazione sopra le slide */
.csw-navigation-top {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 16px;
    width: 100%;
}

.csw-navigation-top .csw-prev,
.csw-navigation-top .csw-next {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    background: #e0e0e0;
    color: #666;
}

.csw-navigation-top .csw-prev:hover:not(.swiper-button-disabled) {
    transform: translateX(-2px);
}

.csw-navigation-top .csw-next:hover:not(.swiper-button-disabled) {
    transform: translateX(2px);
}

.csw-navigation-top .csw-prev.swiper-button-disabled,
.csw-navigation-top .csw-next.swiper-button-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.csw-navigation-top .csw-prev svg,
.csw-navigation-top .csw-next svg {
    width: 20px;
    height: 20px;
    display: block;
}

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

/* Tablet Large (1024px - 1200px) */
@media (max-width: 1200px) {
    .csw-main-title {
        font-size: 36px;
    }

    .csw-left-section {
        padding: 50px 35px;
    }

}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .csw-container {
        flex-direction: column;
        min-height: auto;
        align-items: stretch !important; /* Resetta l'allineamento custom del desktop */
    }

    .csw-left-section {
        flex: 0 0 auto;
        max-width: 100%;
        padding: 40px 30px;
        order: 1; /* Contenuto e navigation vanno prima */
    }

    .csw-right-section {
        flex: 0 0 auto;
        width: 100%;
        padding-left: 0;
        padding: 30px;
        order: 2; /* Slide vanno dopo */
        height: auto;
        min-height: auto;
    }

    /* Fix per swiper su tablet/mobile */
    .csw-right-section .swiper {
        height: auto;
        min-height: auto;
    }

    /* Limita l'altezza delle immagini su tablet */
    .csw-slide-image {
        max-height: 500px;
    }

    .csw-main-title {
        font-size: 32px;
    }
}

/* Mobile Large (480px - 768px) */
@media (max-width: 768px) {
    .csw-left-section {
        padding: 35px 25px;
    }

    .csw-main-title {
        font-size: 28px;
        margin-bottom: 20px;
    }

    .csw-main-description {
        font-size: 15px;
        margin-bottom: 30px;
    }

    .csw-right-section {
        padding: 20px;
    }

    /* Limita ancora di più l'altezza su mobile */
    .csw-slide-image {
        max-height: 400px;
    }

    .csw-slide-title {
        font-size: 20px;
    }

    .csw-prev,
    .csw-next {
        width: 45px;
        height: 45px;
    }

    /* Navigazione top su mobile */
    .csw-navigation-top .csw-prev,
    .csw-navigation-top .csw-next {
        width: 45px;
        height: 45px;
    }
}

/* Mobile (320px - 480px) */
@media (max-width: 480px) {
    .csw-left-section {
        padding: 30px 20px;
    }

    .csw-left-section::before,
    .csw-left-section::after {
        width: 30px;
        height: 30px;
        top: 20px;
        left: 20px;
    }

    .csw-left-section::after {
        bottom: 20px;
        top: auto;
    }

    .csw-main-title {
        font-size: 24px;
    }

    .csw-main-description {
        font-size: 14px;
    }

    .csw-right-section {
        padding: 15px;
    }

    /* Su mobile molto piccolo, altezza ancora più controllata */
    .csw-slide-image {
        max-height: 350px;
    }

    .csw-slide-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .csw-slide-description {
        font-size: 14px;
    }

    .csw-navigation {
        gap: 10px;
    }

    .csw-prev,
    .csw-next {
        width: 42px;
        height: 42px;
    }

    .csw-prev svg,
    .csw-next svg {
        width: 18px;
        height: 18px;
    }

    /* Navigazione top su mobile piccolo */
    .csw-navigation-top {
        gap: 10px;
    }

    .csw-navigation-top .csw-prev,
    .csw-navigation-top .csw-next {
        width: 42px;
        height: 42px;
    }

    .csw-navigation-top .csw-prev svg,
    .csw-navigation-top .csw-next svg {
        width: 18px;
        height: 18px;
    }
}

/* ========================================
   FIX SPECIFICI PER SWIPER
   ======================================== */

/* Assicurati che Swiper non aggiunga overflow hidden */
.custom-swiper-widget .swiper {
    overflow: visible !important;
}

.custom-swiper-widget .swiper-wrapper {
    display: flex;
}

/* Fix per l'altezza delle slide */
.custom-swiper-widget .swiper-slide {
    height: auto !important;
    display: flex;
    flex-direction: column;
}

/* Transizioni smooth */
.custom-swiper-widget .swiper-wrapper {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stati attivi */
.custom-swiper-widget .swiper-slide-active {
    z-index: 2;
}

/* ========================================
   ANIMAZIONI
   ======================================== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.custom-swiper-widget.swiper-initialized .csw-content {
    animation: slideIn 0.6s ease-out;
}

/* ========================================
   UTILITÀ
   ======================================== */

/* Clearfix */
.custom-swiper-widget::after {
    content: "";
    display: table;
    clear: both;
}

/* Nasconde scrollbar se presente */
.custom-swiper-widget .swiper {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.custom-swiper-widget .swiper::-webkit-scrollbar {
    display: none;
}

/* ========================================
   COMPATIBILITÀ ELEMENTOR
   ======================================== */

/* Fix per l'editor di Elementor */
.elementor-editor-active .custom-swiper-widget .swiper {
    overflow: visible !important;
}

/* Z-index management per Elementor */
.elementor-widget-custom-swiper-widget {
    position: relative;
    z-index: 1;
}

/* Print styles */
@media print {
    .csw-navigation {
        display: none;
    }
}