/* BI landing — profili + rail navigazione */

.bi-pbi-demo-section {
    padding: 4rem 0 5rem;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 82, 73, 0.07), transparent 55%),
        linear-gradient(to bottom, #f6f8f7 0%, #fff 100%);
}

.bi-pbi-demo-intro {
    max-width: 820px;
    margin: 0 auto 2rem;
    text-align: center;
}

.bi-pbi-topic-hint {
    margin: 0.75rem auto 0;
    max-width: 640px;
    font-size: 0.85rem;
    color: #5c6570;
    line-height: 1.5;
}

.bi-pbi-topic-hint--note {
    font-size: 0.82rem;
    font-style: italic;
}

.bi-profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 0.75rem;
    max-width: 1100px;
    margin: 0 auto 1.5rem;
}

.bi-profile-card {
    --bi-profile-color: #118dff;
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 4.5rem;
    padding: 0;
    border: 1px solid rgba(0, 55, 49, 0.12);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease, background 0.22s ease;
    font: inherit;
    color: inherit;
    text-align: left;
    overflow: hidden;
}

.bi-profile-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 55, 49, 0.1);
}

.bi-profile-card.is-active {
    border-color: color-mix(in srgb, var(--bi-profile-color) 55%, #fff);
    background: color-mix(in srgb, var(--bi-profile-color) 7%, #fff);
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--bi-profile-color) 35%, transparent),
        0 14px 32px rgba(0, 55, 49, 0.1);
}

.bi-profile-card__accent {
    width: 5px;
    flex-shrink: 0;
    background: var(--bi-profile-color);
}

.bi-profile-card__body {
    padding: 0.85rem 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

.bi-profile-card__title {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a2e2b;
}

.bi-profile-card__sub {
    font-size: 0.68rem;
    line-height: 1.35;
    color: #667;
}

/* Esercizio: stile unico Power BI (accent solo su card profilo/modulo, non sull’anno) */
.bi-pbi-demo-section .ccii-report__slicers,
.ccii-demo-section .ccii-report__slicers {
    padding: 1rem 1.35rem;
    align-items: flex-end;
}

.bi-pbi-demo-section .pbi-slicer--year .pbi-slicer__label,
.ccii-demo-section .pbi-slicer--year .pbi-slicer__label {
    font-size: 0.72rem;
    margin-bottom: 0.4rem;
    color: #323130;
}

.bi-pbi-demo-section .pbi-slicer__control--segmented,
.ccii-demo-section .pbi-slicer__control--segmented {
    display: inline-flex;
    gap: 0;
    padding: 3px;
    background: #edebe9;
    border-radius: 10px;
    border: 1px solid #e1dfdd;
}

.bi-pbi-demo-section .pbi-slicer__btn--year,
.ccii-demo-section .pbi-slicer__btn--year {
    font-size: 1rem;
    font-weight: 600;
    min-width: 5.25rem;
    padding: 0.65rem 1.35rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #605e5c;
    box-shadow: none;
    transform: none;
}

.bi-pbi-demo-section .pbi-slicer__btn--year:hover,
.ccii-demo-section .pbi-slicer__btn--year:hover {
    background: rgba(255, 255, 255, 0.65);
    transform: none;
    box-shadow: none;
}

.bi-pbi-demo-section .pbi-slicer__btn--year[aria-pressed="true"],
.ccii-demo-section .pbi-slicer__btn--year[aria-pressed="true"] {
    background: #fff;
    color: #252423;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.pbi-report-body {
    display: flex;
    align-items: stretch;
    min-height: 480px;
}

.pbi-page-rail {
    flex: 0 0 220px;
    background: #fafbfc;
    border-right: 1px solid #e4e7ec;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100%;
}

.pbi-page-rail__label {
    padding: 0.35rem 1rem 0.5rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8a8886;
}

.pbi-page-rail button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: #323130;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pbi-page-rail button:hover {
    background: #f3f2f1;
}

.pbi-page-rail button[aria-current="page"] {
    background: #f3f2f1;
    border-left-color: #118dff;
    color: #252423;
    font-weight: 600;
}

.pbi-report-canvas {
    flex: 1;
    min-width: 0;
}

/* Grafici: leggibilità e fix animazioni */
.bi-pbi-demo-section .ccii-chart-wrap,
.ccii-demo-section .ccii-chart-wrap {
    min-height: 260px;
    width: 100%;
}

.bi-pbi-demo-section .ccii-chart-wrap svg {
    min-height: 220px;
    max-height: 360px;
}

.bi-pbi-demo-section .pbi-visual .pbi-heatmap-legend {
    margin-bottom: 0.35rem;
}

.bi-pbi-demo-section .hm-cell,
.bi-pbi-demo-section .fm-bar,
.bi-pbi-demo-section .wf-bar {
    animation: none !important;
    transform: none !important;
    opacity: 1;
}

.bi-pbi-demo-section .ccii-chart-wrap.run .ln {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: bi-pbi-line-in 0.85s ease forwards;
}

@keyframes bi-pbi-line-in {
    to {
        stroke-dashoffset: 0;
    }
}

.bi-pbi-demo-section .ccii-canvas.run .ccii-chart-wrap .ln {
    animation: bi-pbi-line-in 0.85s ease forwards;
}

.bi-pbi-demo-section .ccii-chart-wrap.run .bar {
    transform-box: fill-box;
    transform-origin: bottom center;
    animation: bi-pbi-bar-in 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.bi-pbi-demo-section .ccii-chart-wrap.run .bar--stack {
    animation: none !important;
    transform: none !important;
    opacity: 1;
}

.bi-pbi-demo-section .pbi-visual--span-12 .ccii-chart-wrap svg {
    max-height: 420px;
}

@keyframes bi-pbi-bar-in {
    from {
        transform: scaleY(0);
    }
}

.bi-pbi-demo-section .ccii-canvas .ax,
.ccii-demo-section .ccii-canvas .ax {
    font-size: 10px;
}

.pbi-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    font-size: 0.62rem;
    color: #605e5c;
}

.pbi-heatmap-legend i {
    display: block;
    height: 8px;
    width: 48px;
    border-radius: 2px;
    background: linear-gradient(90deg, #deecf9, #005249);
}

.bi-demo-report-bleed {
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .bi-pbi-demo-section,
    .ccii-demo-section {
        padding: 2.5rem 0 3rem;
        overflow-x: clip;
    }

    .bi-pbi-demo-section > .container,
    .ccii-demo-section > .container {
        overflow-x: clip;
    }

    .bi-demo-report-bleed {
        width: calc(100% + 2 * clamp(1rem, 4vw, 1.5rem));
        max-width: 100vw;
        margin-inline: calc(-1 * clamp(1rem, 4vw, 1.5rem));
    }

    .pbi-report-body {
        flex-direction: column;
        min-height: 0;
        position: relative;
    }

    .pbi-report-body::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        width: 2rem;
        height: 3.25rem;
        pointer-events: none;
        background: linear-gradient(90deg, transparent, #fafbfc 85%);
        z-index: 1;
    }

    .pbi-page-rail {
        flex: none;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        border-right: none;
        border-bottom: 1px solid #e4e7ec;
        padding: 0.35rem 0.5rem 0.35rem 0.35rem;
        position: static;
        max-height: none;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .pbi-page-rail__label {
        display: none;
    }

    .pbi-page-rail button {
        flex: 0 0 auto;
        width: auto;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: 8px;
        padding: 0.55rem 0.9rem;
        min-height: 44px;
        scroll-snap-align: start;
    }

    .pbi-page-rail button[aria-current="page"] {
        border-bottom-color: #118dff;
        border-left-color: transparent;
    }

    .bi-profiles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bi-profile-card {
        min-height: 3rem;
    }

    .bi-profile-card__title {
        font-size: 0.88rem;
    }

    .bi-pbi-demo-section .pbi-slicer__btn--year,
    .ccii-demo-section .pbi-slicer__btn--year {
        min-width: 4.5rem;
        min-height: 44px;
        padding: 0.55rem 1rem;
        font-size: 0.95rem;
    }

    .bi-pbi-demo-section .ccii-canvas .ax,
    .ccii-demo-section .ccii-canvas .ax {
        font-size: 11px;
    }
}

@media (max-width: 420px) {
    .bi-profiles-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bi-pbi-demo-section .ccii-chart-wrap.run .bar,
    .bi-pbi-demo-section .ccii-chart-wrap.run .ln {
        animation: none;
        stroke-dashoffset: 0;
        transform: none;
    }
}
