/* ── Layout pagina ── */
.risorse-section {
    padding: 4rem 0;
    background: #ffffff;
}
.risorse-section:nth-child(even) {
    background: #f8fafc;
}
.section-intro {
    max-width: 800px;
    margin: 0 auto 1.5rem 0;
    color: var(--text-dark);
    font-size: 1.05rem;
    line-height: 1.8;
}
.section-intro h2 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: .8rem;
}
.section-intro h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 .6rem;
}
.section-intro p { margin-bottom: 1rem; }

/* ── Tabelle dati ── */
.data-table-wrap {
    width: 100%;
    margin: 0 auto 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;  /* scroll fluido su iOS */
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0,0,0,.07);
}

.data-table {
    width: 100%;
    min-width: 700px;    /* sotto questa larghezza scatta lo scroll orizzontale */
    border-collapse: collapse;
    font-size: .93rem;
    background: #fff;
}

.data-table thead tr {
    background: var(--primary-color, #2a7f4f);
    color: #fff;
}
.data-table th {
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.data-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    line-height: 1.5;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: #f8fafc; }
.data-table tr:hover td { background: #f0f7f3; }

/* Badge colori nelle tabelle */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ── Download bar ── */
.download-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0 auto 3rem;
}
.download-bar-guide {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.4rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark, #1a1a1a);
    transition: box-shadow .2s, transform .2s;
}
.download-bar-guide:hover {
    box-shadow: 0 4px 12px rgba(0,51,153,.1);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--text-dark, #1a1a1a);
}

.download-bar-pdf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.4rem;
    background: #f0f7f3;
    border: 1px solid #c6e6d5;
    border-radius: 8px;
}

.download-bar-info {
    display: flex;
    align-items: center;
    gap: .9rem;
}
.download-bar-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-color, #2a7f4f);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.download-bar-text strong {
    display: block;
    line-height: 1.5;
    font-size: .95rem;
    color: var(--text-dark, #1a1a1a);
}
.download-bar-text span {
    font-size: .82rem;
    color: #475363;
    line-height: 1.5;
    display: inline-block;
}
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--primary-color, #2a7f4f);
    color: #fff;
    padding: .6rem 1.3rem;
    border-radius: 6px;
    border: none;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    white-space: nowrap;
}
.btn-download:hover { background: #0b5ed7; transform: translateY(-1px); }
.btn-download:active { transform: translateY(0); }

/* ── Indice risorse in cima ── */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem auto;
}
.resource-card {
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
    border-top: 4px solid var(--primary-color, #2a7f4f);
    border-radius: 8px;
    padding: 1.2rem;
    text-decoration: none;
    color: var(--text-dark, #1a1a1a);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.resource-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text-dark, #1a1a1a);
}
.resource-card i {
    color: var(--primary-color, #2a7f4f);
    font-size: 1.3rem;
    margin-bottom: .2rem;
}
.resource-card strong { font-size: .95rem; }
.resource-card span { font-size: .8rem; color: #64748b; }

/* ── Note sotto tabella ── */
.table-note {
    max-width: 800px;
    margin: -.8rem auto 1.5rem 0;
    font-size: .82rem;
    color: #4a576a;
    padding: 0 .5rem;
}

/* ── Separatore sezione ── */
.section-divider {
    max-width: 980px;
    margin: 0 auto;
    border: none;
    border-top: 2px solid #e5e7eb;
    margin-bottom: 3rem;
}

@media (max-width: 640px) {
    .data-table { font-size: .8rem; }
    .data-table th, .data-table td { padding: .5rem .65rem; }
    .download-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .data-table {
        font-size: .8rem;
    }
    .data-table th,
    .data-table td {
        padding: .5rem .65rem;
    }
    .download-bar {
        grid-template-columns: 1fr;
    }
}

/* Indicatore visibile solo quando la classe è presente */
.data-table-wrap.is-scrollable::after {
    content: 'scorri per vedere tutto →';
    display: block;
    text-align: right;
    font-size: .75rem;
    color: #94a3b8;
    padding: .35rem .5rem .2rem;
}

/* Ombra destra per suggerire contenuto nascosto */
.data-table-wrap.is-scrollable {
    background:
        linear-gradient(to right, white 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0,
        linear-gradient(to right, rgba(0,0,0,.08), rgba(0,0,0,0)),
        linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.08)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
}