/* Gallery Page Specific Styles */

/* Hero Gallery Section */
.hero-gallery {
    height: 60vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    background-image: url('../images/gallery/2017_0929_16163400-1024x576.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-gallery::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.hero-gallery .hero-content {
    position: relative;
    z-index: 1;
    padding: 0 20px;
    max-width: 800px;
}

.hero-gallery h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-gallery p {
    font-size: 1.7rem;
    margin-bottom: 30px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* Gallery Section */
.gallery-section {
    padding: 80px 0;
    background-color: var(--light-color);
}

.gallery-section .section-header {
    margin-bottom: 50px;
}

.gallery-section .section-header p {
    margin-top: 20px;
    font-size: 1.3rem;
    color: #666;
}

/* Gallery Grid - Actualizado para estilo Collage */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: minmax(200px, auto);
    grid-auto-flow: dense;
    gap: 20px;
    margin-bottom: 40px;
}

.gallery-item {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    box-shadow: var(--box-shadow);
    cursor: pointer; 
    position: relative;
    background-color: #f0f0f0;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Clases para diferentes tamaños de imágenes en el collage */
.gallery-item.large {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 400px;
}

.gallery-item.medium {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 400px;
}

.gallery-item.horizontal {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 200px;
}

.gallery-item.small {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 200px;
}

/* Efecto de superposición con información */
.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
    padding: 20px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-overlay h3 {
    margin: 0 0 5px;
    font-size: 1.4rem;
}

.gallery-item-overlay p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.8;
}

/* Gallery Modal */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal-content {
    position: relative;
    margin: auto;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    max-height: 90vh;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: var(--white);
    font-size: 38px;
    font-weight: bold;
    cursor: pointer;
    z-index: 3000;
    transition: transform 0.3s ease, color 0.3s ease;

}

.close-modal:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.modal-image-container {
    flex: 1;
    position: relative;
    background-color: #000;
    overflow: hidden;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.modal-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10px;
    height: 80px;
}

.image-counter {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 600;
}

.nav-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover { 
    transform: scale(1.1);
    background-color: var(--primary-color);
}

.nav-btn i {
    font-size: 1.2rem;
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-item.horizontal {
        grid-column: span 2;
    }
    
    .gallery-item.large {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .hero-gallery {
        height: 40vh;
    }
    
    .hero-gallery h1 {
        font-size: 2.5rem;
    }
    
    .hero-gallery p {
        font-size: 1.2rem;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .gallery-item.large,
    .gallery-item.medium,
    .gallery-item.horizontal,
    .gallery-item.small {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 250px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
}