/* post-list.css */

/* Stili per la lista dei post - Elegante e minimalista con animazioni */
.post-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-item {
    display: flex;
    flex-direction: row;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
    height: 150px; /* Altezza fissa uguale all'immagine */
}

.post-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #ccc;
}

.post-thumbnail {
    position: relative;
    flex: 0 0 150px;
    min-height: 150px;
    width: 150px;
    height: 150px; /* Forza l'altezza a 150px */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    font-family: 'Montserrat', sans-serif;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.post-category {
    flex-grow: 1;
}

.post-category .post-tag {
    background: #CD212A;
    color: #ffffff;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 3px;
    margin-right: 8px;
    margin-bottom: 0;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    transition: background-color 0.2s ease;
    display: inline-block;
}

.post-category .post-tag:hover {
    background: #b51d24;
}

.post-heading {
    margin-top: 5px;
    margin-bottom: 12px;
    font-family: 'Montserrat', sans-serif;
    height: 5.2em; /* Spazio per 4 righe esatte */
    overflow: hidden;
}

.post-heading a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.3;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Limita a 4 righe */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-heading a:hover {
    color: #CD212A;
    text-decoration: none;
}

.post-date {
    font-size: 0.85rem;
    color: #777;
    display: flex;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    white-space: nowrap;
}

.post-date-icon {
    margin-right: 6px;
    color: #CD212A;
}

/* Stili per il campo di filtraggio del titolo */
.title-filter-form {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.title-filter-form input[type="text"] {
    padding: 10px;
    width: 70%;
    max-width: 300px;
    margin-right: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.2s ease;
}

.title-filter-form input[type="text"]:focus {
    outline: none;
    border-color: #CD212A;
    box-shadow: 0 0 0 2px rgba(205, 33, 42, 0.2);
}

.title-filter-form button {
    padding: 8px 16px;
    background-color: #CD212A;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.title-filter-form button:hover {
    background-color: #b51d24;
}

/* Stile per evidenziare il testo cercato */
.highlight {
    background-color: rgba(205, 33, 42, 0.15);
    padding: 0 2px;
    border-radius: 2px;
}

/* Media queries per migliorare la responsività */
@media screen and (max-width: 767px) {
    /* Tablet e dispositivi medi */
    .post-item {
        flex-direction: row; /* Mantiene il layout orizzontale */
    }
    
    .post-thumbnail {
        width: 130px;
        min-height: 130px;
        flex: 0 0 130px;
    }
    
    .post-content {
        padding: 15px;
    }
}

@media screen and (max-width: 480px) {
    /* Smartphone */
    .post-grid {
        gap: 15px; /* Riduce lo spazio tra i post */
    }
    
    .post-item {
        flex-direction: row;
        height: 110px !important; /* Aumentata l'altezza per mobile */
        width: 100%; /* Assicura che occupi tutta la larghezza */
        flex-wrap: nowrap; /* Evita il wrap degli elementi */
    }
    
    .post-thumbnail {
        width: 100px;
        min-width: 100px;
        height: 110px !important; /* Aumentata l'altezza */
        max-height: 110px;
        min-height: 110px;
        flex: 0 0 100px;
    }
    
    .post-content {
        padding: 6px;
        height: 110px !important; /* Aumentata l'altezza per mobile */
        flex: 1; /* Permette al contenuto di espandersi */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .post-category .post-tag {
        font-size: 0.7rem;
        padding: 1px 5px;
        margin-bottom: 1px;
    }
    
    .post-heading {
        margin-top: 1px;
        margin-bottom: 1px;
        height: 5.6em; /* Aumentata leggermente l'altezza per 4 righe complete */
    }
    
    .post-heading a {
        font-size: 0.8rem;
        line-height: 1.2;
        -webkit-line-clamp: 4; /* Limita a 4 righe */
    }
    
    .post-meta {
        margin-bottom: 1px;
        padding: 0;
    }
    
    .post-date {
        font-size: 0.75rem;
    }
}