:root {
    --primary-color: #005A8D;
    --secondary-color: #00A8E8;
    --background-color: #f0f2f5;
    --surface-color: #ffffff;
    --text-color: #1c1e21;
    --text-secondary-color: #65676b;
    --border-color: #dddfe2;
    --success-color: #42b72a;
    --danger-color: #fa383e;
    --pending-bg-color: #fffbe6;
    --private-color: #6c757d;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --font-family: 'Poppins', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

#root {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.profile-header {
    background-color: var(--surface-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    box-shadow: var(--shadow-2);
    text-align: center;
}

.cover-photo {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    border-radius: 0 0 20px 20px;
    position: relative;
}

.profile-picture-wrapper {
    position: relative;
    width: 160px;
    margin: -80px auto 0;
}

.profile-picture {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 5px solid var(--surface-color);
    display: block;
    box-shadow: var(--shadow-2);
    object-fit: cover;
    position: relative;
    z-index: 2;
}

.profile-info {
    padding: 0 1rem;
}

.profile-info h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 1rem;
}

.profile-info .qualifications {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    margin-top: 0.2rem;
    margin-bottom: 0.8rem;
    font-weight: 400;
    font-style: italic;
}

.profile-info .profile-headline-content {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-secondary-color);
    max-width: 500px;
    margin: 0.5rem auto 0;
}

.profile-contact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem 2rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.profile-contact a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.profile-contact a:hover {
    color: var(--primary-color);
}

.profile-contact svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.profile-contact .contact-text {
    font-weight: 400;
    color: var(--text-color);
}

/* --- START Stili generici per i form di contatto --- */
/* Stili per i form-group, label e input/textarea, validi per tutti i form di contatto */
.contact-form-section .form-group,
#full-contact-section .form-group,
.comments-section .simple-contact-form .form-group {
    margin-bottom: 1rem;
}

.contact-form-section label,
#full-contact-section label,
.comments-section .simple-contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.contact-form-section input[type="text"],
.contact-form-section input[type="email"],
.contact-form-section input[type="tel"],
.contact-form-section textarea,
#full-contact-section input[type="text"],
#full-contact-section input[type="email"],
#full-contact-section input[type="tel"],
#full-contact-section textarea,
.comments-section .simple-contact-form input[type="text"],
.comments-section .simple-contact-form input[type="email"],
.comments-section .simple-contact-form input[type="tel"],
.comments-section .simple-contact-form input[type="password"],
.comments-section .simple-contact-form textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 15px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    box-sizing: border-box;
}

.contact-form-section input[type="text"]:focus,
.contact-form-section input[type="email"]:focus,
.contact-form-section input[type="tel"]:focus,
.contact-form-section textarea:focus,
#full-contact-section input[type="text"]:focus,
#full-contact-section input[type="email"]:focus,
#full-contact-section input[type="tel"]:focus,
#full-contact-section textarea:focus,
.comments-section .simple-contact-form input[type="text"]:focus,
.comments-section .simple-contact-form input[type="email"]:focus,
.comments-section .simple-contact-form input[type="tel"]:focus,
.comments-section .simple-contact-form input[type="password"]:focus,
.comments-section .simple-contact-form textarea:focus {
    outline: 2px solid var(--secondary-color);
    border-color: transparent;
}

/* Stili comuni per il container del form "semplice" - usato sia nell'header che come base per il form full */
.simple-contact-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.simple-contact-form .form-row {
    display: flex;
    gap: 0.75rem;
}

.simple-contact-form .form-row .form-group {
    flex: 1;
}

/* Stili per il form di contatto rapido (nell'header) */
.header-contact-form {
    width: 100%; /* Occupare tutta la larghezza disponibile */
    margin-top: 2rem; /* Mantieni il margine superiore */
    margin-left: 0; /* Rimuovi margini laterali automatici */
    margin-right: 0; /* Rimuovi margini laterali automatici */
    padding: 1.5rem;
    border-top: none;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
}

.header-contact-form form.simple-contact-form {
    gap: 0.75rem;
}

.header-contact-form .cta-button {
    width: 100%; /* Forza la larghezza al 100% all'interno di questo form specifico */
    align-self: center;
}

/* Stili specifici per il form di contatto completo (quello alla fine della pagina, dentro .post-card) */
section#full-contact-section .post-content {
    padding: 1.5rem;
}

section#full-contact-section .contact-form-title-main {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary-color);
}

section#full-contact-section .contact-form-description {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-secondary-color);
}

section#full-contact-section .simple-contact-form {
    max-width: none;
    margin: 0;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
    gap: 1rem;
}

section#full-contact-section .simple-contact-form .form-group {
    margin-bottom: 0;
}

section#full-contact-section .simple-contact-form .cta-button {
    align-self: center;
    width: auto;
    max-width: 300px;
    margin-top: 1.5rem;
}
/* Stili per il messaggio di conferma/errore nei form di contatto */
.contact-form-message-display,
.comment-form-message-display {
    text-align: center;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.4; /* Migliora la leggibilità */
    font-size: 1.1rem; /* Rende il messaggio più grande */
    border-width: 2px; /* Rende il bordo più spesso */
    border-style: solid;
    transition: all 0.3s ease-in-out;
    display: none; /* Aggiunto per nascondere il div per default */
}

.contact-form-message-display.success,
.comment-form-message-display.success {
    color: var(--success-color);
    background-color: #e9f7ef; /* Sfondo leggero verde */
    border-color: var(--success-color);
}

.contact-form-message-display.error,
.comment-form-message-display.error {
    color: var(--danger-color);
    background-color: #ffe6e6; /* Sfondo leggero rosso */
    border-color: var(--danger-color);
}
/* --- END Stili generici per i form di contatto --- */

.confirmation-message {
    color: var(--success-color);
    font-weight: 600;
    text-align: center;
    padding: 1rem;
    border: 1px solid var(--success-color);
    border-radius: var(--border-radius);
    background-color: #e9f7ef;
}

.tabs {
    display: flex;
    justify-content: center;
    background-color: var(--surface-color);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab {
    border: none;
    background: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary-color);
    position: relative;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
}

.about-me-container {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
    padding: 1.5rem; /* Unifica il padding interno con post-card */
    margin-top: 0; /* Rimuovi margin-top, la spaziatura superiore sarà data da .post-category-section */
}

.about-me-container .category-title {
    margin-top: 0;
}

.timeline {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.about-me-container .category-title {
    margin-top: 0;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--secondary-color);
    top: 0;
    bottom: 0;
    left: 20px;
    margin-left: -2px;
    border-radius: 2px;
}

.timeline-item {
    padding: 10px 40px 20px 60px;
    position: relative;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--surface-color);
    border: 4px solid var(--primary-color);
    top: 15px;
    left: 20px;
    border-radius: 50%;
    z-index: 1;
    margin-left: -8px;
}

.timeline-content {
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
}

.timeline-year {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.timeline-description {
    font-size: 1rem;
    color: var(--text-color);
}

.chiama-button-container {
    text-align: center;
    margin-top: 1.5rem;
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.cta-button:hover {
    background-color: var(--secondary-color);
}

.post-category-section {
    padding-top: 1.5rem;
    margin-bottom: 3rem; /* Spazio aggiunto qui */
}

.category-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary-color);
}

.post-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    position: relative;
}

.post-author {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem; /* Modificato da 1rem a 0.5rem */
}

.post-author img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.post-author-info {
    font-weight: 600;
}

.post-author-info span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary-color);
    font-weight: 400;
}

.post-content p {
    margin-bottom: 1rem;
}

.post-image {
    width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

/* Vecchi stili per .post-cta rimossi, ora usa .cta-button */

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.reactions {
    display: flex;
    gap: 1rem;
}

.reaction {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary-color);
    transition: transform 0.2s ease, color 0.2s ease;
}

.reaction:hover {
    transform: scale(1.2);
}

.reaction.reacted {
    color: var(--secondary-color);
}

.reaction span {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1;
}

.comments-toggle {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    
    color: var(--text-secondary-color);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.comments-toggle:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.comments-toggle:active {
    color: var(--secondary-color);
}

.comments-list {
    margin-top: 1rem;
}

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

.comment {
    display: flex;
    gap: 10px;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    background-color: var(--background-color);
    position: relative;
}

.comment.private-comment {
    background-color: var(--pending-bg-color);
    border-left: 4px solid var(--private-color);
}

.comment.pending-comment {
    background-color: var(--pending-bg-color);
    border-left: 4px solid var(--secondary-color);
}

.comment.admin-comment {
    border-left: 4px solid var(--primary-color);
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    object-fit: cover;
}

.comment-body {
    flex-grow: 1;
}

.comment-author-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.comment-author {
    font-weight: 600;
    color: var(--text-color);
}

.comment-timestamp {
    font-size: 0.8em;
    color: var(--text-secondary-color);
}

.comment-text {
    font-size: 0.95rem;
    color: var(--text-color);
    word-wrap: break-word;
}

.comment-actions {
    margin-top: 10px;
}

.reply-comment-button {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
}

.reply-comment-button:hover {
    color: var(--secondary-color);
}

.comment-replies {
    margin-left: 20px;
    margin-top: 10px;
    border-left: 1px solid var(--border-color);
    padding-left: 15px;
}

.comment-form {
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
    margin-top: 1.5rem;
}

.comment-form h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.comment-form .form-group {
    margin-bottom: 1rem;
}

.comment-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* I campi input/textarea nei commenti sono ora inclusi nella regola consolidata più in alto */

.comment-form input:focus,
.comment-form textarea:focus {
    outline: 2px solid var(--secondary-color);
    border-color: transparent;
}

.comment-visibility-options label {
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 15px;
    cursor: pointer;
}

.comment-visibility-options input[type="radio"] {
    margin-right: 5px;
}

/* I bottoni di sottomissione nei commenti sono ora inclusi nella regola consolidata più in alto */

.comment-auth-status {
    background-color: var(--background-color);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-color);
}

.comment-auth-status a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.comment-auth-status a:hover {
    text-decoration: underline;
}

.comment-login-prompt {
    text-align: center;
    margin: 1.5rem 0;
    font-weight: 600;
    color: var(--text-color);
}

.comment-login-prompt a {
    color: var(--primary-color);
    text-decoration: none;
}

.comment-login-prompt a:hover {
    text-decoration: underline;
}

.auth-options-container {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comments-section .login-form,
.comments-section .register-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comments-section .login-form h3,
.comments-section .register-form h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

/* I pulsanti di login/registrazione sono ora gestiti dalla classe .cta-button */
.comments-section .login-button,
.comments-section .register-button {
    width: 100%;
    align-self: center;
}

.comments-section .or-separator {
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary-color);
    font-size: 0.9rem;
}

.comments-section .cancel-auth-button {
    display: block;
    text-align: center;
    margin: 1rem auto 0;
    background: none;
    border: none;
    color: var(--private-color);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Utility classes for display properties */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-block { display: block !important; }


/* --- END Comment Forms (Login/Register) within posts_section --- */
/* --- Stili generici per i form di contatto --- */
.contact-form-section .form-group {
    margin-bottom: 1rem;
}

.contact-form-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Input e textarea per i form di contatto sono ora inclusi nella regola consolidata più in alto */

.simple-contact-form {
    max-width: 500px;
    margin: 1.5rem auto;
    padding: 1.5rem;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
}

.simple-contact-form .cta-button {
    width: auto; /* Permette al bottone di non essere full-width */
    align-self: flex-end; /* Allinea a destra in flex container */
}

/* Floating Action Button (FAB) */
.fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px; /* Space between menu and button */
}

.fab-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-2);
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

.fab-button:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.fab-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

/* FAB Menu */
.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: var(--surface-color); /* Use a surface color */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-2);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.8);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* Prevent interaction when hidden */
}

.fab-container.open .fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto; /* Allow interaction when open */
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap; /* Prevent text wrapping */
}

.fab-menu-item:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.fab-menu-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.fab-menu-item .tooltip {
    font-size: 0.9rem;
    font-weight: 500;
}

/* FINE AGGIUNTE */
@media (max-width: 768px) {
    .profile-info h1 {
        font-size: 2rem;
    }

    .cover-photo {
        height: 200px;
    }

    .profile-picture-wrapper {
        width: 120px;
        margin-top: -60px;
    }

    .profile-picture {
        width: 120px;
        height: 120px;
    }

    .timeline::after {
        left: 10px;
    }

    .timeline-item {
        padding-left: 40px;
    }

    .timeline-item::after {
        left: 10px;
    }

    .header-contact-form .form-row {
        flex-direction: column;
    }

    /* Responsive adjustments for the new form */
    .contact-form-section {
        padding-top: 1rem;
        margin-top: 1rem;
    }

    .contact-form-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .simple-contact-form {
        padding: 1rem;
        gap: 0.75rem;
    }

    .simple-contact-form button[type="submit"] {
        width: 100%;
        align-self: center;
    }

    #full-contact-section .simple-contact-form {
        max-width: 100%;
        padding: 1rem;
    }

    .contact-form-message-display {
        top: 10px;
        min-width: unset;
        width: 90%;
        left: 5%;
        transform: translateX(0);
    }
}

@media (max-width: 480px) {
    #root {
        padding: 0;
    }

    .profile-header,
    .tabs,
    .post-card,
    .about-me-container {
        border-radius: 0;
        margin-bottom: 0.5rem;
    }

    .post-card,
    .about-me-container {
        padding: 1rem;
    }

    .tabs {
        justify-content: flex-start;
    }

    .tab {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .post-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .fab-container {
        bottom: 1rem;
        right: 1rem;
    }

    .fab-button {
        width: 50px;
        height: 50px;
    }

    .fab-button svg {
        width: 20px;
        height: 20px;
    }

    .fab-menu {
        padding: 8px;
    }

    .fab-menu-item {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .fab-menu-item svg {
        width: 18px;
        height: 18px;
    }
}
