/* Improved gallery layout */
.gallery-section { padding: 60px 0; }
.filter-buttons { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.filter-btn { background:var(--light-color); border:1px solid #e6e6e6; padding:8px 12px; border-radius:8px; cursor:pointer; color:var(--text-color); }
.filter-btn.active { background:var(--primary-color); color:var(--white); }
.gallery-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:16px; }
.gallery-item { border-radius:10px; overflow:hidden; background:#fff; box-shadow:var(--shadow); position:relative; }
.gallery-item img { width:100%; height:180px; object-fit:cover; display:block; }
.gallery-overlay { position:absolute; left:0; right:0; bottom:0; background:linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 100%); color:#fff; padding:12px; display:flex; align-items:flex-end; justify-content:space-between; }
.gallery-info h3 { margin:0; font-size:1rem; }
.gallery-actions { display:flex; gap:8px; }
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.85); justify-content:center; align-items:center; z-index:9999; }
.lightbox-content { position:relative; max-width:95%; max-height:90%; }
.lightbox-content img { width:100%; height:auto; display:block; border-radius:8px; }
.lightbox-close { position:absolute; top:-30px; right:-30px; background:#fff; color:#333; border-radius:50%; padding:8px 12px; cursor:pointer; font-size:20px; }
.gallery-footer { text-align:center; margin-top:20px; }

@media (max-width: 600px) {
  .gallery-item img { height:140px; }
  .filter-buttons { gap:6px; }
}
/* Miglioramenti per News e Gallery */

/* News Grid Improvements */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.news-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.news-card.featured {
    border: 2px solid #1e3c72;
    position: relative;
}

.featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(255, 193, 7, 0.3);
}

.news-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card:hover .news-image img {
    transform: scale(1.05);
}

.news-category {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
}

.news-category span {
    background: rgba(30, 60, 114, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-content {
    padding: 1.5rem;
}

.news-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.news-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.4;
}

.news-content p {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e3c72;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.read-more:hover {
    color: #2a5298;
    gap: 0.8rem;
}

/* Gallery Filter Improvements */
.gallery-filter {
    background: #f8f9fa;
    padding: 2rem 0;
    border-bottom: 1px solid #e9ecef;
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.filter-btn:hover {
    border-color: #1e3c72;
    color: #1e3c72;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.2);
}

.filter-btn.active {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-color: #1e3c72;
    color: white;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

/* Animazioni e Transizioni */
.gallery-item {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    background: white;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Animazioni per il filtro */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item.filtered-in {
    animation: fadeInUp 0.5s ease-out;
}

/* Button Loading States */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.gallery-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.8) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info {
    margin-top: auto;
}

.gallery-info h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.gallery-info p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin: 0;
}

.gallery-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.gallery-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.gallery-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Load More Button */
.gallery-footer,
.news-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

/* Lightbox Improvements */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
}

.lightbox-prev,
.lightbox-next {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    backdrop-filter: blur(10px);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Newsletter Section */
.newsletter-section {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 4rem 0;
    margin-top: 4rem;
}

.newsletter-card {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.newsletter-content {
    flex: 1;
}

.newsletter-content h2 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 2rem;
}

.newsletter-content p {
    color: #6c757d;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.newsletter-form .form-group {
    display: flex;
    gap: 1rem;
}

.newsletter-form input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.newsletter-form input:focus {
    outline: none;
    border-color: #1e3c72;
}

.newsletter-icon {
    font-size: 4rem;
    color: #1e3c72;
    opacity: 0.1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .filter-buttons {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .newsletter-card {
        flex-direction: column;
        text-align: center;
        padding: 2rem;
    }
    
    .newsletter-form .form-group {
        flex-direction: column;
    }
    
    .gallery-image {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0 1rem;
    }
    
    .filter-btn {
        flex-shrink: 0;
    }
}
