/* Modern Gallery Styles */

/* Gallery Categories Navigation */
.gallery-categories {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px 0;
    margin-bottom: 60px;
}

.categories-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.category-btn {
    padding: 12px 25px;
    border: none;
    background: white;
    color: #333;
    font-weight: 500;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-family: "Readex Pro", sans-serif;
    font-size: 14px;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background: #f8f9fa;
}

.category-btn.active {
    background: linear-gradient(135deg, #E30613 0%, #ff3344 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(227, 6, 19, 0.4);
}

/* Gallery Container */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.gallery-section {
    margin-bottom: 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-header h3 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #E30613 0%, #ff3344 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 0;
}

/* Modern Grid Layout */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    align-items: start;
}

.grid-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: white;
}

.grid-item.large {
    grid-column: span 2;
}

.grid-item:last-child {
    justify-self: center;
}

.grid-item:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 60px rgba(237, 7, 19, 0.18), 0 10px 25px rgba(0, 0, 0, 0.08);
}

.grid-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.grid-item.large img {
    height: 400px;
}

.grid-item:hover img {
    transform: none;
}

/* Overlay Content - Hidden */
.overlay-content {
    display: none;
}

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

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.4s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-image {
    width: 100%;
    max-height: 70vh;
    object-fit: cover;
}

.modal-info {
    display: none;
}

/* Modal Controls */
.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 10001;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

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

.nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    color: #333;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-categories {
        padding: 30px 0;
        margin-bottom: 40px;
    }
    
    .categories-nav {
        padding: 0 20px;
        gap: 10px;
    }
    
    .category-btn {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .section-header h3 {
        font-size: 2rem;
    }
    
    .section-header p {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .image-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }
    
    .grid-item.large {
        grid-column: span 1;
    }
    
    .grid-item img,
    .grid-item.large img {
        height: 250px;
    }
    
    .overlay-content {
        padding: 30px 20px 20px;
    }
    
    .overlay-content h4 {
        font-size: 1.2rem;
    }
    
    .overlay-content p {
        font-size: 0.9rem;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 95%;
        border-radius: 15px;
    }
    
    .modal-info {
        padding: 20px;
    }
    
    .modal-info h4 {
        font-size: 1.4rem;
    }
    
    .modal-info p {
        font-size: 1rem;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .close-modal {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .section-header h3 {
        font-size: 1.8rem;
    }
    
    .gallery-section {
        margin-bottom: 60px;
    }
    
    .modal-nav {
        padding: 0 15px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Animation for section transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Improved loading states */
.grid-item img {
    transition: opacity 0.3s ease;
}

.grid-item img[src=""] {
    opacity: 0;
}

.grid-item img:not([src=""]) {
    opacity: 1;
}

/* Hover effects for better interactivity */
.category-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.3);
}

.grid-item:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.3);
}

/* Center the last image in each gallery grid */
.gallery-section:not([data-category="agrovida"]) .image-grid .grid-item:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 600px;
}

.gallery-section[data-category="agrovida"] .image-grid .grid-item:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 600px;
}