/* =========================================================
   COMMENTI STYLES - Stile moderno ispirato al box di ricerca
   ========================================================= */

/* Header sezione commenti */
.gh-comments-header {
    margin-top: 4rem;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e6e6e6;
}

/* Riduce lo spazio sopra l'header quando c'è related-wrapper prima */
.related-wrapper + .gh-comments .gh-comments-header {
    margin-top: 0;
}

/* Riduce lo spazio sotto l'header quando non ci sono commenti */
.gh-comments-header + .comments-area:has(.no-comments-message):not(:has(.comment-list)) {
    margin-top: -1.5rem;
}

.gh-comments-title {
    font-size: 2rem;
    margin-bottom: 0;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    text-transform: uppercase;
}

/* "COMMENTI" in blu grassetto */
.gh-comments-title-text {
    color: #2f6f8f !important;
    font-weight: 700;
}

/* "(2)" in blu senza grassetto */
.gh-comments-count-text {
    color: #2f6f8f !important;
    font-weight: 400;
}

/* Assicura che il titolo dei commenti sia sempre visibile */
.gh-comments-header .gh-comments-title {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Lista commenti esistenti - Stile moderno e pulito */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 4rem;
}

.comment-list .comment {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e6e6e6;
}

.comment-list .comment:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Indentazione risposte: solo la prima risposta è indentata, le successive rimangono allo stesso livello */
.comment-list .children {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0 3rem;
}

/* Rimuove ulteriore indentazione per risposte dopo la prima */
.comment-list .children .children {
    margin-left: 0;
}

.comment-body {
    display: block;
}

.comment-meta {
    margin-bottom: 1rem;
}

/* Nasconde l'avatar */
.comment-author .avatar {
    display: none !important;
}

.comment-author {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.comment-author .fn {
    font-weight: 600;
    font-size: 1.5rem;
    color: #2f6f8f;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.comment-author .says {
    color: #666;
    font-size: 1.4rem;
    font-weight: 400;
}

.comment-metadata {
    margin-top: 0;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.comment-metadata a {
    color: #999;
    font-size: 1.3rem;
    text-decoration: none;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    transition: color 0.2s ease;
}

.comment-metadata a:hover {
    color: #2f6f8f;
    text-decoration: none;
}

.comment-awaiting-moderation {
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-style: italic;
    color: #666;
    font-size: 1.3rem;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.comment-content {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    line-height: 1.7;
    color: #333;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.comment-content p {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

/* Link Rispondi - stile moderno con tocco blu */
.comment .reply {
    margin-top: 1rem;
}

.comment-reply-link {
    color: #2f6f8f;
    font-size: 1.4rem;
    text-decoration: none;
    font-weight: 500;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    transition: color 0.2s ease, opacity 0.2s ease;
    display: inline-block;
}

.comment-reply-link:hover {
    color: #255a75;
    text-decoration: underline;
}

/* Messaggio quando non ci sono commenti - impilati verticalmente */
.comments-area:has(.no-comments-message):not(:has(.comment-list)) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 120px;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.no-comments-message {
    display: block !important;
    visibility: visible !important;
    margin: 0;
    padding: 0.5em 0;
    color: #444;
    font-size: 1.6rem;
    font-style: italic;
    text-align: center;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Form commenti */
#respond {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid #e6e6e6;
}

/* Riduce lo spazio quando c'è related-wrapper prima */
.related-wrapper + .gh-comments #respond {
    margin-top: 3rem;
    padding-top: 3rem;
}

/* Aumenta lo spazio quando ci sono commenti (lista commenti presente) */
.comments-area:has(.comment-list) #respond {
    margin-top: 4rem;
    padding-top: 3rem;
}

/* Riduce lo spazio sopra il form quando c'è il messaggio "nessun commento" */
.comments-area:has(.no-comments-message):not(:has(.comment-list)) #respond {
    margin-top: 2rem;
    padding-top: 2rem;
}

.comment-reply-title {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1.5rem;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.comment-notes {
    margin-bottom: 0;
    margin-top: 1rem;
    font-size: 1.4rem;
    color: #666;
    line-height: 1.5;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    display: none; /* Nascondo di default, verrà mostrato dopo email tramite JS */
}

.comment-notes.comment-notes-moved {
    display: block;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.comment-notes #email-notes {
    display: block;
    margin-bottom: 0.5rem;
}

.comment-notes .required-field-message {
    display: block;
    margin-top: 0.5rem;
}

/* Nasconde il messaggio "Connesso come..." con i link Modifica profilo e Uscire */
.logged-in-as {
    display: none !important;
}

.comment-notes .required {
    color: #2f6f8f;
}

/* Campi form */
.comment-form-comment,
.comment-form-author,
.comment-form-email {
    margin-bottom: 2rem;
}

.comment-form-comment label,
.comment-form-author label,
.comment-form-email label {
    display: block;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.8rem;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.comment-form-comment textarea,
.comment-form-author input,
.comment-form-email input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.6rem;
    color: #333;
    background-color: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    outline: none;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comment-form-comment textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.comment-form-comment textarea:focus,
.comment-form-author input:focus,
.comment-form-email input:focus {
    border-color: #2f6f8f;
    box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.1);
}

.comment-form-comment textarea::placeholder,
.comment-form-author input::placeholder,
.comment-form-email input::placeholder {
    color: #999;
}

/* Checkbox cookies - nascosta */
.comment-form-cookies-consent {
    display: none !important;
}

.comment-form-cookies-consent input[type="checkbox"] {
    margin-top: 0.3rem;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    accent-color: #2f6f8f;
    flex-shrink: 0;
    flex-grow: 0;
    align-self: flex-start;
    margin-left: 0;
    margin-right: 0.8rem;
}

.comment-form-cookies-consent label {
    font-size: 1.4rem;
    color: #666;
    line-height: 1.5;
    cursor: pointer;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Bottone submit */
.form-submit {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

#submit {
    width: 33.333%;
    padding: 15px 30px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    background-color: #2f6f8f;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.5;
    min-height: 50px;
}

#submit:hover {
    background-color: #255a75;
    transform: translateY(-1px);
}

#submit:active {
    transform: translateY(0);
}

/* Link cancella risposta */
#cancel-comment-reply-link {
    font-size: 1.3rem;
    color: #999;
    text-decoration: none;
    margin-left: 1rem;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

#cancel-comment-reply-link:hover {
    color: #2f6f8f;
    text-decoration: underline;
}

/* Messaggio nessun commento */
.no-comments {
    font-size: 1.5rem;
    color: #666;
    font-style: italic;
    margin-top: 2rem;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Responsive */
@media (max-width: 767px) {
    /* Header sezione commenti - riduce spazi e font */
    .gh-comments-header {
        margin-top: 3rem;
        margin-bottom: 2rem;
        padding-bottom: 0.8rem;
    }
    
    .gh-comments-title {
        font-size: 1.6rem;
    }
    
    /* Lista commenti - riduce spazi */
    .comment-list {
        margin: 0 0 2rem;
    }
    
    .comment-list .comment {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    /* Indentazione risposte ridotta su mobile */
    .comment-list .children {
        margin-left: 1.5rem;
    }
    
    .comment-body {
        flex-direction: column;
        gap: 1rem;
    }
    
    .comment-meta {
        margin-bottom: 0.8rem;
    }
    
    .comment-metadata,
    .comment-awaiting-moderation {
        margin-left: 0;
    }
    
    .comment-author {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    .comment-author .fn {
        font-size: 1.3rem;
    }
    
    .comment-author .says {
        font-size: 1.2rem;
    }
    
    .comment-metadata a {
        font-size: 1.2rem;
    }
    
    .comment-awaiting-moderation {
        font-size: 1.2rem;
    }
    
    .comment-content {
        font-size: 1.4rem;
        line-height: 1.6;
    }
    
    .comment-reply-link {
        font-size: 1.3rem;
    }
    
    /* Header - riduce spazio quando non ci sono commenti */
    .gh-comments-header {
        margin-bottom: 1rem;
    }
    
    /* Riduce spazio sopra header quando c'è related-wrapper */
    .related-wrapper + .gh-comments .gh-comments-header {
        margin-top: 0;
    }
    
    /* Lista commenti - aumenta spazio sotto su mobile */
    .comment-list {
        margin: 0 0 3rem;
    }
    
    /* Form - aumenta spazio quando ci sono commenti */
    .comments-area:has(.comment-list) #respond {
        margin-top: 3rem;
        padding-top: 2rem;
    }
    
    /* Messaggio nessun commento - spaziatura ridotta su mobile, layout verticale */
    .comments-area:has(.no-comments-message):not(:has(.comment-list)) {
        flex-direction: column;
        align-items: stretch;
        min-height: 80px;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .no-comments-message {
        font-size: 1.4rem;
    }
    
    /* Form - riduce spazio quando c'è messaggio "nessun commento" */
    .comments-area:has(.no-comments-message):not(:has(.comment-list)) #respond {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    /* Form commenti - riduce spazi e font */
    #respond {
        margin-top: 3rem;
        padding-top: 2rem;
    }
    
    .related-wrapper + .gh-comments #respond {
        margin-top: 2rem;
        padding-top: 2rem;
    }
    
    .comment-reply-title {
        font-size: 1.6rem;
        margin-bottom: 1.2rem;
    }
    
    .comment-notes {
        font-size: 1.3rem;
    }
    
    .comment-notes.comment-notes-moved {
        margin-top: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .comment-form-comment,
    .comment-form-author,
    .comment-form-email {
        margin-bottom: 1.5rem;
    }
    
    .comment-form-comment label,
    .comment-form-author label,
    .comment-form-email label {
        font-size: 1.3rem;
        margin-bottom: 0.6rem;
    }
    
    .comment-form-comment textarea,
    .comment-form-author input,
    .comment-form-email input {
        padding: 12px 15px;
        font-size: 1.5rem;
    }
    
    .comment-form-comment textarea {
        min-height: 100px;
    }
    
    .form-submit {
        margin-top: 1.5rem;
        justify-content: center;
    }
    
    #submit {
        width: 100%;
        padding: 15px;
        font-size: 1.4rem;
        min-height: 48px;
    }
    
    #cancel-comment-reply-link {
        font-size: 1.2rem;
        margin-left: 0.8rem;
    }
    
    /* Paginazione commenti - ottimizzata per mobile */
    .comment-navigation,
    .comments-pagination {
        margin: 2rem 0;
        gap: 6px;
    }
    
    .comment-navigation .nav-links,
    .comments-pagination .nav-links {
        gap: 6px;
    }
    
    .comment-navigation .page-numbers,
    .comments-pagination .page-numbers {
        min-width: 40px;
        height: 40px;
        padding: 0 10px;
        font-size: 13px;
    }
}

/* Dialog di conferma commento - stile simile alla ricerca */
.gh-comment-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    padding-top: 100px;
}

.gh-comment-dialog-overlay.is-open {
    display: block;
}

.gh-comment-dialog-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding: 0 20px;
}

.gh-comment-dialog-container {
    background: #fff;
    border-radius: 4px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gh-comment-dialog-message {
    font-size: 1.8rem;
    color: #333;
    line-height: 1.6;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    margin: 0;
}

.gh-comment-dialog-close {
    margin-top: 2rem;
    padding: 12px 30px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    background-color: #2f6f8f;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-family: Mulish, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.gh-comment-dialog-close:hover {
    background-color: #255a75;
}

@media (max-width: 767px) {
    .gh-comment-dialog-overlay {
        padding-top: 60px;
    }
    
    .gh-comment-dialog-container {
        padding: 30px 20px;
    }
    
    .gh-comment-dialog-message {
        font-size: 1.6rem;
    }
    
    .gh-comment-dialog-close {
        width: 100%;
        padding: 15px;
    }
}
