/* Gallery Page Styles */
.page-title {
    padding: calc(var(--spacing-xl) + 40px) 0 var(--spacing-md) 0;
    text-align: center;
    position: relative;
    background-color: var(--color-tertiary);
    overflow: hidden;
}

.page-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/imagen_6.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: 0;
    filter: blur(2px);
}

.page-title .container {
    position: relative;
    z-index: 1;
}

.gallery-description {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    color: var(--color-text-light);
    font-size: 1.1rem;
}

.gallery-page {
    padding: var(--spacing-lg) 0 var(--spacing-xl) 0;
    background-color: #fff;
}

/* Gallery Filters */
.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: var(--spacing-lg);
}

.filter-btn {
    background-color: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    padding: 0.6rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: rgba(19, 139, 66, 0.1);
}

.filter-btn.active {
    background-color: var(--color-primary);
    color: white;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.gallery-item {
    opacity: 1;
    transform: scale(1);
    transition: all 0.5s ease;
}

.gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    position: absolute;
    z-index: -1;
    pointer-events: none;
}

.gallery-image-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    aspect-ratio: 4/3;
    cursor: pointer;
}

.gallery-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-image-container:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-image-container:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info {
    text-align: center;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: var(--border-radius);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-width: 80%;
}

.gallery-image-container:hover .gallery-info {
    transform: translateY(0);
}

.gallery-info h3 {
    margin-bottom: 0.3rem;
    font-size: 1.2rem;
    color: white;
}

.gallery-info p {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.view-btn {
    display: inline-block;
    background-color: var(--color-primary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background-color: rgba(19, 139, 66, 0.9);
    transform: translateY(-2px);
}

/* Modal Gallery */
.modal-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-gallery.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: -1;
}

.modal-container {
    position: relative;
    max-width: 1200px;
    width: 90%;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    /* Altura máxima para evitar que ocupe toda la pantalla en dispositivos grandes */
    max-height: 90vh;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: var(--color-primary);
}

.modal-content {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Contenedor de imagen con tamaño fijo */
.modal-image-container {
    width: 100%;
    /* Establecer altura fija para imágenes */
    height: 500px;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.fixed-size {
    transition: all 0.3s ease;
}

.modal-info {
    padding: 1.5rem;
    background-color: white;
    min-height: 100px; /* Altura mínima para información */
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.modal-description {
    color: var(--color-text-light);
    line-height: 1.6;
}

.modal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--color-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    color: var(--color-text);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-nav:hover {
    background-color: var(--color-primary);
    color: white;
}

.modal-counter {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* Zoom animation */
.zoom-in {
    animation: zoomIn 0.3s ease forwards;
}

@media (max-width: 768px) {
    .modal-image-container {
        height: 350px; /* Menor altura en dispositivos móviles */
    }
    
    .modal-info {
        min-height: 80px;
    }
}

/* Ajustes para dispositivos muy pequeños */
@media (max-width: 480px) {
    .modal-image-container {
        height: 300px;
    }
    
    .modal-container {
        width: 95%;
    }
}

/* Soporte para modo oscuro */
@media (prefers-color-scheme: dark) {
    .modal-container {
        background-color: #222;
    }
    
    .modal-info {
        background-color: #222;
    }
    
    .modal-image-container {
        background-color: #111;
    }
}

/* Mejorar accesibilidad - foco visible en controles */
.modal-nav:focus, .modal-close:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.zoom-out {
    animation: zoomOut 0.3s ease forwards;
}

@keyframes zoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .modal-container {
        width: 95%;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    .modal-controls {
        padding: 0.8rem 1rem;
    }
    
    .modal-nav {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-filters {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .gallery-image-container img,
    .gallery-image-container:hover img,
    .gallery-info,
    .gallery-image-container:hover .gallery-info,
    .modal-gallery,
    .view-btn:hover,
    .zoom-in,
    .zoom-out {
        transition: none;
        animation: none;
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .modal-info {
        background-color: #222;
    }
    
    .modal-title {
        color: white;
    }
    
    .modal-description {
        color: rgba(255, 255, 255, 0.8);
    }
    
    .modal-controls {
        background-color: #111;
    }
    
    .modal-nav {
        background-color: #333;
        color: white;
    }
    
    .modal-counter {
        color: rgba(255, 255, 255, 0.7);
    }
}