/* css/style-eventi.css (Definitivo con Centratura Mobile Corretta) */

body {
    background-color: #f4f6f9;
}

.page-header {
    padding: 60px 0;
    background: linear-gradient(rgba(0, 86, 179, 0.8), rgba(0, 64, 128, 0.9)), url('https://picsum.photos/1600/400?random=101') center center/cover;
    color: white;
    text-align: center;
    margin-bottom: 50px;
}
.page-header h1 { margin: 0; font-size: 42px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }
.page-header p { margin: 10px 0 0 0; font-size: 18px; opacity: 0.9; }

/* --- Layout a due colonne con sidebar per filtri --- */
.page-wrapper {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: flex-start;
    padding-bottom: 60px;
}
.events-main-content { flex: 1; min-width: 0; }
.filters-sidebar {
    flex-basis: 320px;
    flex-shrink: 0;
    padding: 25px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.07);
    position: sticky;
    top: 20px;
}

/* --- FILTERS SIDEBAR --- */
.filter-form h3 { margin: 0 0 20px 0; font-size: 22px; padding-bottom: 15px; border-bottom: 2px solid #0056b3; color: #333; }
.filter-widget { margin-bottom: 20px; }
.filter-widget:last-child { margin-bottom: 0; }
.filter-widget label { display: block; font-weight: bold; margin-bottom: 8px; font-size: 14px; color: #495057; }
.filter-widget input[type="text"], 
.filter-widget select, 
.filter-widget input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
}
.filter-widget-group { display: flex; gap: 10px; }
.filter-actions { display: flex; gap: 10px; }
.filter-actions .btn-submit,
.filter-actions .reset-filters {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.filter-actions .btn-submit { background-color: #0056b3; color: white; }
.filter-actions .btn-submit:hover { background-color: #004080; }
.filter-actions .reset-filters { background-color: #6c757d; color: white; }
.filter-actions .reset-filters:hover { background-color: #5a6268; }


/* --- GRIGLIA EVENTI PRINCIPALE --- */
.events-grid {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* CORREZIONE: justify-content centra gli elementi della griglia */
    justify-content: center;
}
.event-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}
.event-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.12); }
.event-card-image { position: relative; }
.event-card-image img { width: 100%; height: 180px; object-fit: cover; display: block; }
.event-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.event-date { font-size: 13px; font-weight: bold; color: #6c757d; margin-bottom: 10px; display: block; }
.event-content h3 { font-size: 20px; margin: 0 0 10px 0; color: #004080; line-height: 1.4; }
.event-location { font-size: 15px; color: #495057; margin-bottom: 15px; }
.event-category { font-size: 12px; font-weight: bold; color: #d12727; text-transform: uppercase; border-top: 1px solid #f0f0f0; padding: 15px 20px; margin-top: auto; }

/* --- STATISTICHE EVENTO SULLA CARD --- */
.event-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}
.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}
.stat-item svg { width: 14px; height: 14px; }
.stat-item.occupied { background-color: #ffe8e8; color: #b32424; }
.stat-item.vacant { background-color: #d4edda; color: #155724; }
.stat-item.maybe { background-color: #fff3cd; color: #856404; }
.stat-item.open { background-color: #d1ecf1; color: #0c5460; }

/* --- EVENT CARD STATUS OVERLAY --- */
.event-status-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px;
    color: white;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-terminated { background-color: rgba(108, 117, 125, 0.85); }
.status-closed { background-color: rgba(220, 53, 69, 0.85); }
.status-full { background-color: rgba(255, 193, 7, 0.9); color: #212529; }

/* --- PAGINAZIONE --- */
.pagination-container { margin-top: 50px; display: flex; justify-content: center; }
.pagination { display: flex; gap: 8px; }
.pagination a { color: #0056b3; padding: 10px 15px; text-decoration: none; border: 1px solid #dee2e6; border-radius: 5px; background-color: #fff; font-weight: bold; }
.pagination a:hover { background-color: #e9ecef; }
.pagination a.active { background-color: #0056b3; color: white; border-color: #0056b3; }

/* --- ULTIME NOTIZIE NELLA SIDEBAR --- */
.sidebar-news-section { margin-top: 30px; padding-top: 25px; border-top: 1px solid #e9ecef; }
.sidebar-news-section h3 { margin: 0 0 20px 0; font-size: 22px; color: #333; }
.sidebar-news-grid { display: grid; gap: 20px; }
.news-card-sidebar { display: block; text-decoration: none; color: inherit; background-color: #fff; border-radius: 8px; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; border: 1px solid #e9ecef; }
.news-card-sidebar:hover { transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
.news-card-sidebar img { width: 100%; height: 120px; object-fit: cover; display: block; }
.news-card-content { padding: 15px; }
.news-card-content h4 { margin: 0; font-size: 15px; line-height: 1.4; color: #333; }
.post-stats { display: flex; align-items: center; gap: 15px; font-size: 13px; color: #6c757d; }
.post-stats .stat-item { display: flex; align-items: center; gap: 5px; }
.post-stats svg { width: 14px; height: 14px; opacity: 0.7; }

/* --- RESPONSIVE DESIGN (CORRETTO E MIGLIORATO) --- */
@media (max-width: 992px) {
    .page-wrapper {
        flex-direction: column;
        /* CORREZIONE: Allinea gli elementi al centro quando sono in colonna */
        align-items: center;
    }
    .filters-sidebar, .events-main-content {
        width: 90%; /* Forza entrambi gli elementi ad occupare la larghezza massima */
        max-width: 100%;
        position: static;
        top: unset;
        margin-bottom: 40px;
    }
    .filters-sidebar {
         margin-bottom: 40px;
    }
    .filter-form h3 {
        text-align: center;
    }
    .filter-widget-group {
        flex-direction: column;
        gap: 20px;
    }
    .filter-widget input[type="text"], 
    .filter-widget select, 
    .filter-widget input[type="date"],
    .filter-actions .btn-submit, 
    .filter-actions .reset-filters {
        font-size: 16px;
        padding: 14px;
    }
}

@media (max-width: 767px) {
    .events-grid {
        grid-template-columns: 1fr;
    }
}