/* ============================================
   BCI Risorse Widgets — Stili
   Brand: gold #BC8E50 / navy #13255B / Poppins
   ============================================ */

/* Anti-FOUC */
.bci-rw-grid,
.bci-rw-hub-cards,
.bci-rw-hub-section {
    visibility: hidden;
}
.bci-rw-grid.bci-ready,
.bci-rw-hub-cards.bci-ready,
.bci-rw-hub-section.bci-ready {
    visibility: visible;
}

/* ============================================
   Card
   ============================================ */
.bci-rw-card {
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(19, 37, 91, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.bci-rw-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(19, 37, 91, 0.14);
}
.bci-rw-card__link {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.bci-rw-card__cover {
    aspect-ratio: 16 / 9;
    background-color: #f5f5f5;
    background-size: cover;
    background-position: center;
    width: 100%;
}
.bci-rw-card__body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.bci-rw-card__meta {
    display: flex;
    gap: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #BC8E50;
    font-weight: 600;
    margin-bottom: 8px;
}
.bci-rw-card__title {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
    color: #13255B;
    margin: 0 0 8px;
}
.bci-rw-card__excerpt {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #4a4a4a;
    margin: 0 0 12px;
    flex: 1;
}
.bci-rw-card__cta {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #13255B;
    margin-top: auto;
}

/* ============================================
   Grid
   ============================================ */
.bci-rw-grid {
    width: 100%;
}
.bci-rw-grid__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}
.bci-rw-grid__chip {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #13255B;
    color: #13255B;
    background: transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    cursor: pointer;
}
.bci-rw-grid__chip:hover {
    background: #45557D;
    color: #fff;
    border-color: #45557D;
}
.bci-rw-grid__chip.is-active {
    background: #13255B;
    color: #fff;
}
.bci-rw-grid__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-auto-rows: 1fr;
    align-items: stretch;
    gap: 24px;
}
.bci-rw-grid__cards .bci-rw-card {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}
.bci-rw-grid__inner {
    position: relative;
}
.bci-rw-grid__empty {
    padding: 40px 0;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    color: #888;
    font-size: 15px;
}
.bci-rw-grid__loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    color: #13255B;
    font-weight: 600;
    z-index: 10;
}
.bci-rw-grid.is-loading .bci-rw-grid__loading {
    display: flex;
}

/* Paginazione */
.bci-rw-grid__pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
}
.bci-rw-grid__page {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #13255B;
    border: 1px solid #13255B;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}
.bci-rw-grid__page:hover {
    background: #45557D;
    color: #fff;
    border-color: #45557D;
}
.bci-rw-grid__page.is-active {
    background: #13255B;
    color: #fff;
    pointer-events: none;
}

/* ============================================
   Hub Cards (snodo)
   ============================================ */
.bci-rw-hub-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.bci-rw-hub-card {
    background: linear-gradient(135deg, #13255B 0%, #45557D 100%);
    color: #fff;
    border-radius: 5px;
    padding: 32px 28px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}
.bci-rw-hub-card:hover {
    transform: translateY(-4px);
}
.bci-rw-hub-card__icon {
    font-size: 32px;
    color: #BC8E50;
    margin-bottom: 16px;
}
.bci-rw-hub-card__title {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #fff;
}
.bci-rw-hub-card__subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255,255,255,0.85);
    margin: 0 0 16px;
    flex: 1;
}
.bci-rw-hub-card__count {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(188, 142, 80, 0.2);
    color: #BC8E50;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: lowercase;
    margin-bottom: 16px;
    align-self: flex-start;
}
.bci-rw-hub-card__cta {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #BC8E50;
}

/* ============================================
   Hub Section (preview)
   ============================================ */
.bci-rw-hub-section {
    margin: 56px 0;
}
.bci-rw-hub-section__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(19, 37, 91, 0.12);
    padding-bottom: 12px;
}
.bci-rw-hub-section__title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #13255B;
    margin: 0;
}
.bci-rw-hub-section__cta {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #BC8E50;
    text-decoration: none;
}
.bci-rw-hub-section__cta:hover {
    color: #13255B;
}
.bci-rw-hub-section__cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.bci-rw-hub-section__empty {
    font-family: 'Poppins', sans-serif;
    color: #888;
    text-align: center;
    padding: 24px 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .bci-rw-grid .bci-rw-grid__cards {
        grid-template-columns: 1fr !important; /* verticale su tablet — fallback se control Elementor non scrive responsive */
    }
    .bci-rw-hub-cards,
    .bci-rw-hub-section__cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .bci-rw-grid .bci-rw-grid__cards {
        grid-template-columns: 1fr !important;
    }
    .bci-rw-hub-cards,
    .bci-rw-hub-section__cards {
        grid-template-columns: 1fr;
    }
    .bci-rw-grid__chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .bci-rw-grid__chip {
        flex: 0 0 auto;
    }
    .bci-rw-hub-section__header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* ============================================
   HERO 2 colonne (BCI Risorse Hero widget)
   ============================================ */
.bci-rw-hero {
    position: relative;
    padding: 64px 24px;
    background: linear-gradient(135deg, #13255B 0%, #45557D 100%);
    color: #fff;
    overflow: hidden;
    min-height: 420px;
    display: flex;
    align-items: center;
}
.bci-rw-hero__overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 50%, rgba(188, 142, 80, 0.12) 0%, transparent 60%);
    pointer-events: none;
}
.bci-rw-hero__inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 48px;
    align-items: center;
}
.bci-rw-hero__left {
    display: flex;
    flex-direction: column;
}
.bci-rw-hero__subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #BC8E50;
    margin: 0 0 16px;
}
.bci-rw-hero__title {
    font-family: 'Poppins', sans-serif;
    font-size: 48px;
    line-height: 1.1;
    font-weight: 800;
    color: #fff;
    margin: 0 0 16px;
}
.bci-rw-hero__description {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 24px;
    max-width: 520px;
}
/* deprecated v1.3.0 — sostituiti da CTA */
.bci-rw-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 24px;
}
.bci-rw-hero__badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.bci-rw-hero__badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.bci-rw-hero__badge--manuali {
    background: #13255B;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.bci-rw-hero__badge--ebook {
    background: #BC8E50;
    color: #fff;
}
.bci-rw-hero__badge--corsi {
    background: #008F39;
    color: #fff;
}
.bci-rw-hero__badge--percorsi {
    background: #C97A5F;
    color: #fff;
}
.bci-rw-hero__breadcrumb {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}
.bci-rw-hero__breadcrumb a {
    color: #BC8E50;
    text-decoration: none;
    transition: color 0.2s ease;
}
.bci-rw-hero__breadcrumb a:hover {
    color: #fff;
}
.bci-rw-hero__breadcrumb-sep {
    color: rgba(255, 255, 255, 0.4);
}
.bci-rw-hero__breadcrumb-current {
    color: #fff;
    font-weight: 500;
}

/* Mosaico 2x2 destra hero */
.bci-rw-hero__right {
    display: flex;
    align-items: center;
    justify-content: center;
}
.bci-rw-hero__mosaic {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 3 / 4;  /* portrait — non taglia più le cover ebook/manuali */
}
.bci-rw-hero__mosaic-item {
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s ease;
}
/* Rotation default "alternating" — modifier numerici da v1.3.0 */
.bci-rw-hero__mosaic-item--1 { transform: rotate(-3deg); }
.bci-rw-hero__mosaic-item--2 { transform: rotate(2deg); }
.bci-rw-hero__mosaic-item--3 { transform: rotate(-2deg); }
.bci-rw-hero__mosaic-item--4 { transform: rotate(3deg); }

/* Override quando rotation = "none" o "unified" via data-attribute */
.bci-rw-hero__mosaic[data-rotation="none"] .bci-rw-hero__mosaic-item {
    transform: none;
}
.bci-rw-hero__mosaic[data-rotation="unified"] .bci-rw-hero__mosaic-item {
    transform: rotate(-2deg);
}

/* Legacy v1.2.x modifier (deprecated, kept harmless): */
.bci-rw-hero__mosaic-item--manuali  { transform: rotate(-3deg); }
.bci-rw-hero__mosaic-item--ebook    { transform: rotate(2deg);  }
.bci-rw-hero__mosaic-item--corsi    { transform: rotate(-2deg); }
.bci-rw-hero__mosaic-item--percorsi { transform: rotate(3deg);  }
.bci-rw-hero__mosaic-item:hover {
    transform: rotate(0deg) scale(1.04);
}

/* CTA Bottoni Hero */
.bci-rw-hero__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 24px;
}
.bci-rw-hero__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 5px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    border: 2px solid transparent;
}
.bci-rw-hero__cta:hover {
    transform: translateY(-2px);
}
.bci-rw-hero__cta--primary {
    background-color: #BC8E50;
    color: #ffffff;
}
.bci-rw-hero__cta--primary:hover {
    background-color: #13255B;
}
.bci-rw-hero__cta--secondary {
    background-color: transparent;
    color: #ffffff;
    border-color: #ffffff;
}
.bci-rw-hero__cta--secondary:hover {
    background-color: #BC8E50;
    color: #ffffff;
    border-color: #BC8E50;
}

/* ============================================
   CAROUSEL (BCI Risorse Carousel widget)
   ============================================ */
.bci-rw-carousel {
    margin: 56px 0;
    scroll-margin-top: 80px;
}
/* v1.5.4-5.5: alignment FORZATO con CSS variable condivisa tra header e track.
   Stesso valore di padding-left/right → titolo allineato all'inizio della prima card cross-breakpoint.
   Il control "Padding header" del widget tocca solo padding-top/bottom → left/right sono BLOCCATI da queste regole. */
.bci-rw-carousel__wrap {
    --bci-rw-side-padding: 24px;
}
@media (max-width: 768px) {
    .bci-rw-carousel__wrap {
        --bci-rw-side-padding: 20px;
    }
}

/* v1.5.7: rollback v1.5.6 — header torna ad avere padding orizzontale uguale al track.
   Lo stesso valore (var --bci-rw-side-padding) viene applicato a header E track → titolo allineato all'inizio della prima card. */
.bci-rw-carousel__header {
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 24px !important;
    padding-left: var(--bci-rw-side-padding, 24px) !important;
    padding-right: var(--bci-rw-side-padding, 24px) !important;
    padding-inline-start: var(--bci-rw-side-padding, 24px) !important;
    padding-inline-end: var(--bci-rw-side-padding, 24px) !important;
    text-align: left !important;
    box-sizing: border-box !important;
}
/* v1.5.2-1.5.3: reset aggressivo di padding/margin laterali su titolo e sottotitolo
   per evitare offset introdotti dal tema (WGL/Ureg/Hello applicano spesso margin a h2/p). */
.bci-rw-carousel__header .bci-rw-carousel__title,
.bci-rw-carousel__header .bci-rw-carousel__subtitle {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-indent: 0 !important;
}
.bci-rw-carousel__title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #13255B;
    margin: 0 0 4px;
}
.bci-rw-carousel__subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #888;
    margin: 0;
}
.bci-rw-carousel__wrap {
    position: relative;
    max-width: 1248px;
    margin: 0 auto;
}
.bci-rw-carousel__track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* v1.5.7: rollback v1.5.6 — padding torna sul track (era stato spostato sul wrap, causando regressioni visive).
       Le card di nuovo calcolano la loro larghezza in base al content box del track. */
    padding-top: 8px;
    padding-bottom: 24px;
    padding-left: var(--bci-rw-side-padding, 24px) !important;
    padding-right: var(--bci-rw-side-padding, 24px) !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    /* v1.5.8: stretch verticale forzato → tutte le card stessa altezza nel carousel */
    align-items: stretch !important;
}
.bci-rw-carousel__track::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Edge */
}
.bci-rw-carousel__track .bci-rw-card {
    /* v1.5.7: rollback al calc originale v1.5.5 — niente -1px fudge che restringeva visivamente le card. */
    flex: 0 0 calc((100% - (var(--bci-rw-ipv, 3) - 1) * 16px) / var(--bci-rw-ipv, 3));
    width: auto;
    max-width: none;
    scroll-snap-align: start;
    /* v1.5.8: stretch verticale forzato + height 100% per uniformare l'altezza tra card con titoli diversi */
    align-self: stretch !important;
    height: auto !important;
}
.bci-rw-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #13255B;
    color: #13255B;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(19, 37, 91, 0.15);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.bci-rw-carousel__arrow:hover {
    background: #13255B;
    color: #fff;
    transform: translateY(-50%) scale(1.06);
}
.bci-rw-carousel__arrow--prev {
    left: -22px;
}
.bci-rw-carousel__arrow--next {
    right: -22px;
}
.bci-rw-carousel__arrow span {
    margin-top: -3px; /* ottico centering del lsaquo/rsaquo */
}
.bci-rw-carousel__empty {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    color: #888;
}

/* Card compact (modifier per carousel)
   v1.5.0: in contesto carousel la larghezza e' guidata da --bci-rw-ipv (responsive).
   Fuori contesto carousel (es. manual cards in grid) la fixed-280px resta. */
.bci-rw-card--compact {
    width: 280px;
}
.bci-rw-carousel__track .bci-rw-card--compact {
    width: auto;
}
.bci-rw-card--compact .bci-rw-card__cover {
    aspect-ratio: 16 / 9;
}
.bci-rw-card--compact .bci-rw-card__body {
    padding: 14px 18px 18px;
}
.bci-rw-card--compact .bci-rw-card__title {
    font-size: 15px;
    line-height: 1.3;
    margin-bottom: 6px;
    /* clamp a 2 righe */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bci-rw-card--compact .bci-rw-card__meta {
    font-size: 10px;
    margin-bottom: 6px;
}
.bci-rw-card--compact .bci-rw-card__cta {
    font-size: 12px;
}

/* ============================================
   Responsive Hero + Carousel
   ============================================ */
@media (max-width: 1024px) {
    .bci-rw-hero__title {
        font-size: 36px;
    }
}
@media (max-width: 768px) {
    .bci-rw-hero {
        padding: 48px 20px;
        min-height: auto;
    }
    .bci-rw-hero__inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .bci-rw-hero__right {
        display: none; /* mosaico nascosto su mobile per leggerezza */
    }
    .bci-rw-hero__title {
        font-size: 32px;
    }
    .bci-rw-hero__description {
        font-size: 15px;
    }
    .bci-rw-hero__badges {
        gap: 6px;
    }
    .bci-rw-hero__badge {
        font-size: 11px;
        padding: 6px 12px;
    }
    .bci-rw-carousel {
        margin: 40px 0;
    }
    /* v1.5.4: padding header e track ora gestiti da --bci-rw-side-padding (= 20px su mobile) */
    .bci-rw-carousel__title {
        font-size: 22px;
    }
    .bci-rw-carousel__arrow {
        display: none; /* frecce nascoste su mobile, swipe touch sufficiente */
    }
    /* v1.5.0: rimosso override fixed 240px — la larghezza card e' guidata da --bci-rw-ipv-m via calc() (default mobile = 1 card). */
    .bci-rw-card--compact-deprecated-mobile-fixed {
        flex: 0 0 240px;
        width: 240px;
    }
}

/* ============================================
   GRID v1.3.0 — Pallini (dots mode slider)
   ============================================ */
.bci-rw-grid__viewport {
    overflow: hidden;
    position: relative;
    width: 100%;
}
.bci-rw-grid__cards--track {
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}
.bci-rw-grid__dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
}
.bci-rw-grid__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(19, 37, 91, 0.25);
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}
.bci-rw-grid__dot:hover {
    background-color: rgba(19, 37, 91, 0.55);
    transform: scale(1.15);
}
.bci-rw-grid__dot.is-active {
    background-color: #13255B;
    transform: scale(1.25);
}

/* Hero — Immagine personalizzata (mockup) */
.bci-rw-hero__image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.bci-rw-hero__image-link {
    display: inline-block;
    transition: transform 0.3s ease;
}
.bci-rw-hero__image-link:hover {
    transform: translateY(-4px);
}
@media (max-width: 768px) {
    .bci-rw-hero__image {
        max-width: 80% !important; /* su mobile ridurre il mockup per non occupare tutta la verticale */
    }
}

/* ============================================
   Carousel v1.3.4 — Layout mobile/tablet
   Quando il widget è in modalità "vertical_stack", su <=1024px il track
   diventa una colonna verticale (come Grid), le frecce sono nascoste.
   ============================================ */
@media (max-width: 1024px) {
    .bci-rw-carousel--mobile-vertical_stack .bci-rw-carousel__track {
        flex-direction: column !important;
        overflow-x: visible !important;
        gap: 24px !important;
        padding: 8px 20px 20px !important;
        scroll-snap-type: none !important;
    }
    .bci-rw-carousel--mobile-vertical_stack .bci-rw-carousel__track .bci-rw-card,
    .bci-rw-carousel--mobile-vertical_stack .bci-rw-card--compact {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        scroll-snap-align: none !important;
    }
    .bci-rw-carousel--mobile-vertical_stack .bci-rw-carousel__arrow {
        display: none !important;
    }
}

/* ============================================
   v1.3.5 — Same-height cards (Grid)
   grid-auto-rows: 1fr forza tutte le righe ad avere la stessa altezza
   (basata sulla card più alta — utile quando i titoli hanno lunghezze diverse)
   ============================================ */
.bci-rw-grid__cards {
    grid-auto-rows: 1fr;
}

/* ============================================
   v1.3.5 — Swipe touch su Grid mode dots (mobile/tablet)
   Su <=1024px il viewport diventa scrollabile nativamente (swipe touch).
   Il JS gestisce sia scrollLeft per i pallini sia onscroll per aggiornare il pallino attivo.
   ============================================ */
@media (max-width: 1024px) {
    .bci-rw-grid__viewport[data-pagination-mode="dots"] {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }
    .bci-rw-grid__viewport[data-pagination-mode="dots"]::-webkit-scrollbar {
        display: none; /* WebKit */
    }
    .bci-rw-grid__viewport[data-pagination-mode="dots"] .bci-rw-grid__cards--track {
        transform: none !important; /* su mobile usiamo scroll nativo, no transform */
        transition: none !important;
    }
    .bci-rw-grid__viewport[data-pagination-mode="dots"] .bci-rw-card {
        scroll-snap-align: start;
    }
}

/* ============================================
   v1.4.0 — List mode (BCI Risorse Display)
   Layout magazine: cover sinistra + body destra, 1 colonna piena
   ============================================ */
.bci-rw-list {
    width: 100%;
}
.bci-rw-list__items {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.bci-rw-list__item {
    display: grid;
    grid-template-columns: minmax(200px, 320px) 1fr;
    gap: 24px;
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(19, 37, 91, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.bci-rw-list__item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(19, 37, 91, 0.14);
}
.bci-rw-list__cover-link {
    display: block;
    height: 100%;
}
.bci-rw-list__cover {
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: #f5f5f5;
    height: 100%;
    min-height: 200px;
}
.bci-rw-list__body {
    padding: 24px 32px 24px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.bci-rw-list__title {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    color: #13255B;
    margin: 0 0 8px;
}
.bci-rw-list__title a {
    color: inherit;
    text-decoration: none;
}
.bci-rw-list__title a:hover {
    color: #BC8E50;
}
.bci-rw-list__excerpt {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #4a4a4a;
    margin: 0 0 12px;
}
.bci-rw-list__cta {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #13255B;
    text-decoration: none;
    align-self: flex-start;
}
.bci-rw-list__cta:hover {
    color: #BC8E50;
}
.bci-rw-list__meta {
    margin-bottom: 8px;
}
.bci-rw-list__chips {
    margin-bottom: 32px;
}

/* Responsive */
@media (max-width: 768px) {
    .bci-rw-list__item {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .bci-rw-list__cover {
        min-height: auto;
        aspect-ratio: 16 / 9;
    }
    .bci-rw-list__body {
        padding: 20px;
    }
    .bci-rw-list__title {
        font-size: 18px;
    }
}

/* v1.4.1 — Hide arrows in Display widget carousel mode (always) */
.elementor-widget-bci-rw-display .bci-rw-carousel__arrow {
    display: none !important;
}

/* v1.4.1 — Display widget header (title + subtitle) per Grid/List mode */
/* v1.5.3: full width + padding 0 — .bci-rw-grid e .bci-rw-list sono full width,
   quindi il testo del titolo deve essere allineato al column-left (= card 1 left) senza offset. */
.bci-rw-display__header {
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 24px !important;
    padding: 0 !important;
    text-align: left !important;
    box-sizing: border-box !important;
}
.bci-rw-display__title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #13255B;
    margin: 0 0 4px;
}
.bci-rw-display__subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #888;
    margin: 0;
}
/* v1.5.3: reset aggressivo padding/margin laterali dei tag interni per battere overrides di tema */
.bci-rw-display__header .bci-rw-display__title,
.bci-rw-display__header .bci-rw-display__subtitle {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-indent: 0 !important;
}

/* v1.4.2 — Card same-height: line-clamp safety net */
.bci-rw-card__title {
    overflow-wrap: break-word;
}
.bci-rw-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.bci-rw-card__cta {
    margin-top: auto;
}

/* v1.4.3 — Manual cards containers */
.bci-rw-display__manual--grid .bci-rw-grid__cards {
    grid-auto-rows: 1fr;
    align-items: stretch;
}
.bci-rw-display__manual-card {
    height: 100%;
}

/* ============================================
   v1.5.0 — Carousel responsive items_per_view
   Le var --bci-rw-ipv-d / -t / -m sono impostate inline sulla section (via PHP)
   e il viewport ne sceglie una in --bci-rw-ipv.
   ============================================ */
.bci-rw-carousel {
    --bci-rw-ipv: var(--bci-rw-ipv-d, 3);
}
@media (max-width: 1024px) {
    .bci-rw-carousel {
        --bci-rw-ipv: var(--bci-rw-ipv-t, 2);
    }
}
@media (max-width: 767px) {
    .bci-rw-carousel {
        --bci-rw-ipv: var(--bci-rw-ipv-m, 1);
    }
}

/* ============================================
   v1.5.0 — Carousel pagination (numeri + pallini)
   Stessa logica visiva del Grid, contenitori dedicati per scope CSS pulito.
   ============================================ */
.bci-rw-carousel__pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 32px;
    flex-wrap: wrap;
}
.bci-rw-carousel__page {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #13255B;
    background: transparent;
    border: 1px solid #13255B;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease;
}
.bci-rw-carousel__page:hover {
    background: #45557D;
    color: #fff;
    border-color: #45557D;
}
.bci-rw-carousel__page.is-active {
    background: #13255B;
    color: #fff;
    pointer-events: none;
}
.bci-rw-carousel__dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}
.bci-rw-carousel__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(19, 37, 91, 0.25);
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}
.bci-rw-carousel__dot:hover {
    background-color: rgba(19, 37, 91, 0.55);
    transform: scale(1.15);
}
.bci-rw-carousel__dot.is-active {
    background-color: #13255B;
    transform: scale(1.25);
}
