/* Definizioni dei colori */
:root {
    /* LIGHT MODE */
    --background-color: #f4f4f4;
    --card-background: #fff;
    --text-color: #333;
    --title-color: #444;
    --subtitle-color: #666;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-color: #eee;
    --button-primary: #FF6F61;
    --button-primary-hover: #ff4b3e;
}

.dark-theme {
    /* DARK MODE */
    --background-color: #121212;
    --card-background: #1e1e1e;
    --text-color: #e0e0e0;
    --title-color: #f5f5f5;
    --subtitle-color: #b0b0b0;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --border-color: #333;
    --button-primary: #FF6F61; /* Mantenuto il rosso per coerenza */
    --button-primary-hover: #ff4b3e;
}

/* Base styles */
body {
    font-family: 'Arial', sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease; /* Transizione per il Dark Mode */
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 10px 20px var(--shadow-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    color: var(--title-color);
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: var(--subtitle-color);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.errore1 a {
    background: var(--button-primary);
    padding: 10px 18px;
    text-decoration: none;
    color: #fff;
    display: inline-block;
    margin: 10px 0;
    border-radius: 5px;
    position:absolute;
    top: 20px;
    left: 20px;
    font-size: 1rem;
    box-shadow: 0 4px 10px var(--shadow-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.errore1 a:hover {
    background: var(--button-primary-hover);
}

/* Grid layout for posts */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Individual post card */
.post {
    background: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.post:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.post h2 {
    font-size: 1.5rem;
    color: var(--title-color);
    margin: 0;
    padding: 15px 20px 0;
    transition: color 0.3s ease;
}

.post p {
    font-size: 1rem;
    color: var(--subtitle-color);
    padding: 0 20px 20px;
    margin: 0;
    transition: color 0.3s ease;
}

.read-more {
    display: block;
    text-align: center;
    background: var(--button-primary);
    color: #fff;
    text-decoration: none;
    padding: 10px 0;
    font-size: 0.9rem;
    margin: 15px 20px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.read-more:hover {
    background: var(--button-primary-hover);
}

.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    transition: border-top 0.3s ease;
}

.comment {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--background-color);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.comment-header strong {
    font-size: 0.9em;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.comment-header span {
    font-size: 0.8em;
    color: var(--subtitle-color);
    transition: color 0.3s ease;
}

.delete-comment-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0 5px;
}

.delete-comment-btn:hover {
    color: #c0392b;
}

/* Stile per il pulsante "Mostra altri" */
.toggle-comments {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    padding: 5px 0;
    margin-top: 10px;
    font-size: 0.9em;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-color);
    transition: color 0.3s ease;
}

#comment-username {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background: var(--card-background);
    color: var(--text-color);
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

#comment-username:invalid {
    border-color: #ff6b6b; /* Rosso se non valido */
}

#comment-username:valid {
    border-color: #4CAF50; /* Verde se valido */
}

.input-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--subtitle-color);
    transition: color 0.3s ease;
}

#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--text-color); /* Cambiato per dark mode */
    color: var(--background-color); /* Cambiato per dark mode */
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 50%;
    font-size: 18px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#backToTopBtn:hover {
    background-color: #555;
}

.containerFooter {
    max-width: 1000px;
    margin: auto;
    padding: 0 20px;
}
.rowFooter {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;  
    gap: 30px;
}
.footer {
    background-color: #1a1a1d;
    padding: 40px 0 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.footer-col {
    flex: 1;
    min-width: 180px;
    padding: 0 15px;
    margin-bottom: 20px;
}
.footer-col h4 {
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 20px;
    font-weight: 600;
    position: relative;
    letter-spacing: 0.5px;
}
.footer-col h4::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    background-color: #4e73df;
    height: 2px;
    width: 40px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li:not(:last-child) { margin-bottom: 8px; }
.footer-col ul li a {
    font-size: 14px;
    color: #b1b1b1;
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s ease;
    display: inline-block;
}
.footer-col ul li a:hover { color: #ffffff; transform: translateX(5px); }
.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #2d2d30;
    margin-top: 20px;
}
.footer-bottom p { color: #777; font-size: 13px; margin: 0; }

/* Responsive */
@media (max-width: 768px) {
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-col {
        width: 50%;
        padding: 0 15px;
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    .footer-col {
        width: 100%;
        text-align: center;
    }
    
    .footer-col h4::before {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-col ul li a:hover {
        transform: none;
        padding-left: 5px;
    }
}