/* === BASE STYLES === */
h3 {
    color: #374ca7;
    font-size: 1.5em;
    margin-top: 30px;
    margin-bottom: 0px;
}

/* === TABLE WRAPPER ) === */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 30px 0;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
    -webkit-overflow-scrolling: touch; /* Smooth scroll su iOS */
}

/* === TABLE STYLES === */
table {
    width: 100%;
    min-width: 600px; 
    border-collapse: collapse;
    margin: 0;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #043160, #1e5289);
}

th {
    color: white;
    padding: 18px;
    text-align: left;
    font-size: 1.1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap; /* Previene wrap indesiderato */
}

tbody tr {
    background: linear-gradient(135deg, #f0f3ff 0%, #e8ecff 100%);
    transition: all 0.3s ease;
}

tbody tr:nth-child(even) {
    background: linear-gradient(135deg, #e3e8ff 0%, #dce2ff 100%);
}

td {
    padding: 15px 18px;
    border: 1px solid #043160;
    word-break: break-word; /* Permette di spezzare parole lunghe */
}

/* Link nelle tabelle */
td a {
    color: #1e5289;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

td a:hover {
    color: #043160;
    text-decoration: underline;
}

/* === HIGHLIGHT BOX === */
.highlight {
    background: linear-gradient(120deg, #fef5e7 0%, #fff9e6 100%);
    padding: 20px;
    border-left: 4px solid #f39c12;
    border-right: 4px solid #f39c12;
    margin: 25px 0;
}

/* === IMAGES === */
.image-placeholder {
    width: fit-content;
    max-width: 100%;
    background: rgba(139, 69, 19, 0.1);
    border: 2px dashed #d4a574;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8B4513;
    font-style: italic;
    margin: 20px auto;
    break-inside: avoid;
    font-size: 0.95rem;
    text-align: center;
    padding: 10px;
}

.image-placeholder img {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.figure-caption {
    font-size: 0.9rem;
    color: #333;
    text-align: center;
    font-style: italic;
    line-height: 1.4;
    padding: 0 10px;
    margin: 0 0 20px 0;
}

/* === REFERENCES SECTION === */
.references-section {
    margin-top: 3rem;
}

.references-toggle {
    background: linear-gradient(135deg, #043160, #1e5289);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(4, 49, 96, 0.3);
}

.references-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(4, 49, 96, 0.4);
}

.references-title {
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.references-arrow {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.references-toggle.active .references-arrow {
    transform: rotate(180deg);
}

.references-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.references-content.expanded {
    max-height: 3000px;
    overflow-y: auto;
}

.references-list {
    padding: 2rem;
    list-style: none;
    margin: 0;
}

.references-list li {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-left: 4px solid var(--par-title-color);
    border-radius: 4px;
    line-height: 1.5;
    font-size: 0.9rem;
}


/* === TABLET (768px - 991px) === */
@media (max-width: 991px) {
    h3 {
        font-size: 1.3em;
    }
    
    .table-wrapper {
        margin: 20px 0;
    }
    
    table {
        min-width: 550px;
    }
}

/* === MOBILE LARGE (577px - 767px) === */
@media (max-width: 767px) {
    h3 {
        font-size: 1.2em;
        margin-top: 25px;
    }
    
    th {
        font-size: 0.9em;
        padding: 12px 10px;
        letter-spacing: 0.5px;
    }
    
    td {
        padding: 10px;
        font-size: 0.9em;
    }
    
    .highlight {
        padding: 15px;
        margin: 20px 0;
    }
    
    .image-placeholder {
        padding: 8px;
    }
    
    .references-list {
        padding: 1.5rem;
    }
    
    .references-list li {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
}

/* === MOBILE MEDIUM (400px - 576px) === */
@media (max-width: 576px) {
    /* Paragrafo introduttivo */
    p[style*="border-left"] {
        font-size: 1rem !important;
        padding: 15px !important;
        line-height: 1.6 !important;
    }
    
    h3 {
        font-size: 1.1em;
    }
    
    .table-wrapper {
        border-radius: 8px;
        box-shadow: 0 3px 15px rgba(102, 126, 234, 0.15);
    }
    
    table {
        min-width: 500px;
        font-size: 0.85em;
    }
    
    th {
        font-size: 0.8em;
        padding: 10px 8px;
    }
    
    td {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .highlight {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .image-placeholder img {
        max-height: 200px;
    }
    
    .figure-caption {
        font-size: 0.85rem;
    }
    
    .references-title {
        font-size: 1.1rem;
    }
    
    .references-toggle {
        padding: 0.8rem 1rem;
    }
}

/* === MOBILE SMALL (< 400px) === */
@media (max-width: 400px) {
    p[style*="border-left"] {
        font-size: 0.95rem !important;
        padding: 12px !important;
        border-left-width: 3px !important;
        border-right-width: 3px !important;
    }
    
    h3 {
        font-size: 1em;
        margin-top: 20px;
    }
    
    table {
        min-width: 480px;
        font-size: 0.8em;
    }
    
    th {
        font-size: 0.75em;
        padding: 8px 6px;
    }
    
    td {
        padding: 6px;
    }
    
    .highlight {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .references-list {
        padding: 1rem;
    }
    
    .references-list li {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
}

/* === EXTRA SMALL (< 320px) === */
@media (max-width: 320px) {
    table {
        min-width: 450px;
    }
    
    .table-wrapper {
        margin: 15px 0px; 
    }
}