/* =========================================
   ARTICLE STYLE - SHARED
   Stili condivisi tra articoli Linguistica e Logopedia
   ========================================= */

/* Variabili CSS per differenziare i temi */
:root {
    /* Linguistica - Giallo */
    --article-lin-header-bg: url('../img/Header_Banner_Lin.png');
    --article-lin-primary: rgb(254, 199, 81);
    --article-lin-text: rgb(30, 53, 96);
    --article-lin-footnote-header-bg: rgb(254, 199, 81);
    --article-lin-footnote-header-text: #1d2f53;

    /* Logopedia - Blu */
    --article-log-header-bg: url('../img/Header_Banner_Log.png');
    --article-log-primary: rgb(30, 53, 96);
    --article-log-text: rgb(254, 199, 81);
    --article-log-footnote-header-bg: rgb(30, 53, 96);
    --article-log-footnote-header-text: rgb(254, 199, 81);
}

/* =========================================
   STILI COMUNI A TUTTI GLI ARTICOLI
   ========================================= */

.article-header {
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
    font-family: 'Montserrat', sans-serif;
}

.article-header h1 {
    font-family: 'bebas Neue', sans-serif;
    font-size: 3.5rem;
    color: #333;
    margin-bottom: 0.5rem;
    position: relative;
    padding-bottom: 20px;
}

.article-header h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 125px;
    height: 5px;
    background: var(--color-divider);
}

.article-meta {
    color: black;
    font-size: 1.2rem;
    padding-top: 0.75rem;
    font-family: "Montserrat", sans-serif;
    font-weight: 200;
}

.article-container {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
}

/* INDICE DELL'ARTICOLO - DESKTOP */
.article-toc {
    background: white;
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    transition: all 0.3s ease;
}

.toc-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.toc-content h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #1d2f53;
    padding-bottom: 0.5rem;
}

.toc-nav ul {
    font-family: 'Montserrat', sans-serif;
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-nav li {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.toc-nav a {
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
    display: block;
    padding: 0.25rem 0;
    border-left: 3px solid transparent;
    padding-left: 0.5rem;
}

.toc-nav a:hover,
.toc-nav a.active {
    color: #2c3e50;
    border-left-color: #2c3e50;
    font-weight: 600;
}

.toc-nav ul ul {
    font-family: 'Montserrat', sans-serif;
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.toc-nav ul ul a {
    font-size: 0.85rem;
    color: #6c757d;
}

.toc-nav ul ul a:hover,
.toc-nav ul ul a.active {
    color: #2c3e50;
}

.toc-nav ul ul ul {
    font-family: 'Montserrat', sans-serif;
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.toc-nav ul ul ul a {
    font-size: 0.85rem;
    color: #6c757d;
}

.toc-nav ul ul ul a:hover,
.toc-nav ul ul ul a.active {
    color: #2c3e50;
}

/* PULSANTE TOGGLE INDICE PER MOBILE */
.toc-toggle {
    display: none;
    position: fixed;
    top: 120px;
    right: 20px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    z-index: 1001;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 1.2rem;
}

.toc-toggle:hover {
    background: #1a252f;
}

/* STILE BREADCRUMB */
.breadcrumb {
    background: #f8f9fa;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: "›";
    margin: 0 0.5rem;
    color: #6c757d;
}

.breadcrumb a {
    color: #1d2f53;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #6ab2e6;
    text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
    color: #6c757d;
    font-weight: 500;
}

/* CONTENUTO ARTICOLO */
.article-content {
    flex: 3;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    max-height: 1100px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.article-content h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #333;
    padding-top: 3rem;
    margin-top: -2rem;
}

.article-content h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: #444;
    padding-top: 3rem;
    margin-top: -2rem;
}

.article-content h4 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.15rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: #444;
    padding-top: 3rem;
    margin-top: -2rem;
}

.article-content h5 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.10rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    color: #444;
    padding-top: 3rem;
    margin-top: -2rem;
}

.article-content p {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    text-align: justify;
    text-indent: 1.75em;
}

.article-content blockquote {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-style: italic;
    line-height: 1.5;
    text-align: justify;
    margin: 1.5em 2em;
    padding-left: 1em;
    border-left: 2.75px solid #ccc;
}

.article-content ul,
.article-content ol {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    text-align: justify;
}

.article-content li {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.6;
    text-align: justify;
}

.article-content table {
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    text-align: justify;
}

.article-content th,
.article-content td {
    font-family: 'Montserrat', sans-serif;
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #dee2e6;
}

.article-content th {
    font-family: 'Montserrat', sans-serif;
    background-color: #f8f9fa;
    font-weight: 600;
}

.references {
    font-family: 'Montserrat', sans-serif;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.references h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
}

.references ul {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

/* NOTE A PIÈ DI PAGINA COME POP-UP */
.footnote-ref {
    text-decoration: none;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin: 0 0.1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
}

.footnote-ref:hover {
    background: #2c3e50;
    color: white;
    text-decoration: none;
    border-color: #2c3e50;
}

/* Pop-up delle note */
.footnote-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    overflow: hidden;
}

.footnote-popup.active {
    display: block;
    animation: footnoteFadeIn 0.3s ease;
}

@keyframes footnoteFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.footnote-popup-content {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.footnote-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #6c757d;
    cursor: pointer;
    z-index: 10001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.footnote-close:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.footnote-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.category-logopedia {
    background: rgb(30, 53, 96);
    color: #fff;
}

.category-linguistica {
    background: rgb(254, 199, 81);
    color: #222;
}

.footnote-header h3 {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    font-size: 1.5rem;
}

.footnote-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: 60vh;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    text-align: justify;
}

.footnote-body p {
    margin-bottom: 1rem;
}

.footnote-body p:last-child {
    margin-bottom: 0;
}

/* Overlay per lo sfondo */
.footnote-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.footnote-overlay.active {
    display: block;
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Stili per le note all'interno del testo */
.footnotes-definitions {
    display: none !important;
}

/* SIDEBAR */
.article-sidebar {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

.info-box {
    font-family: 'Montserrat', sans-serif;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.info-box h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #1d2f53;
    padding-bottom: 0.5rem;
}

.info-box p {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.3;
}

.author-info {
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.author-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 1rem;
    object-fit: cover;
}

.license-info {
    font-family: 'Montserrat', sans-serif;
    text-align: center;
    line-height: 1.3;
    margin: 1.5rem 0;
}

.license-img {
    max-width: 150px;
    margin: 0 auto 1rem;
    display: block;
}

.download-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #2c3e50;
    color: white;
    text-align: center;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
    margin-top: 1rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.download-btn:hover {
    background-color: #1a252f;
}

/* PULSANTI AZIONE ARTICOLO */
.article-actions {
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 25px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.action-btn:hover {
    background: #1a252f;
    transform: translateY(-2px);
}

.action-btn img {
    width: 20px;
    height: 20px;
}

/* DROPDOWN CONDIVISIONE */
.share-dropdown {
    position: relative;
    display: inline-block;
}

.share-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    z-index: 1000;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

.share-options.active {
    display: block;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #333;
    border: none;
    background: none;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.share-option:hover {
    background-color: #f8f9fa;
}

.share-option img {
    width: 20px;
    height: 20px;
}

/* SEZIONE COMMENTI */
.comments-section {
    font-family: 'Montserrat', sans-serif;
    margin-top: 3rem;
    padding: 2rem 0;
}

.comments-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.comments-section h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
    text-align: center;
}

.comments-description {
    color: #6c757d;
    margin-bottom: 2rem;
    text-align: center;
}

.comment-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.comment-form h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: "Montserrat", sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

/* SISTEMA DI VALUTAZIONE A STELLE */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: 0.25rem;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    color: #ddd;
    font-size: 1.5rem;
    transition: color 0.2s;
}

.star-rating label:hover,
.star-rating label:hover~label {
    color: #ffc107;
}

.star-rating input:checked~label {
    color: #ffc107;
}

.star-rating input:checked+label:hover,
.star-rating input:checked+label:hover~label,
.star-rating input:checked~label:hover,
.star-rating input:checked~label:hover~label {
    color: #ffc107;
}

/* PULSANTE INVIO */
.submit-btn {
    background-color: #2c3e50;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

.submit-btn:hover {
    background-color: #1a252f;
}

/* LISTA COMMENTI */
.comments-list h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.comment-item {
    background: #fff;
    font-family: 'Montserrat', sans-serif;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* Risposte indentate */
.comment-reply {
    font-family: 'Montserrat', sans-serif;
    margin-left: 2rem;
    margin-top: 1rem;
    border-left: 3px solid #2c3e50;
    padding-left: 1rem;
    background-color: #f8f9fa;
    border-radius: 0 15px 15px 0;
}

.comment-reply .comment-reply {
    margin-left: 1.5rem;
    background-color: #f1f3f4;
}

/* Pulsante Rispondi */
.comment-actions {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e9ecef;
    text-align: right;
    font-family: 'Montserrat', sans-serif;
}

.reply-btn {
    background: none;
    border: 1px solid #2c3e50;
    color: #2c3e50;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.reply-btn:hover {
    background-color: #2c3e50;
    color: white;
}

/* Messaggio nessun commento */
.no-comments-message {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    margin: 2rem 0;
}

.no-comments-message p {
    font-size: 1.1rem;
    font-family: 'Montserrat', sans-serif;
    color: #6c757d;
    margin: 0;
}

.no-comments-message.hidden {
    display: none;
}

/* Indicatore risposta in corso */
.replying-indicator {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
}

.replying-indicator strong {
    color: #1976d2;
}

/* Messaggi di errore */
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* MESSAGGI */
.message {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* PULSANTE BACK TO TOP */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    background: #1a252f;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top img {
    width: 30px;
    height: 30px;
    filter: brightness(1) invert(1);
}

.back-to-top.visible {
    display: flex;
}