/* Estilos para la galería de fotos */
:root {
    --gallery-primary: #1a3e72;
    --gallery-secondary: #00a0e9;
    --gallery-accent: #ff6b00;
    --gallery-light: #f8f9fa;
    --gallery-dark: #212529;
}

.gallery-section {
    padding: 80px 0;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}

.gallery-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 62, 114, 0.05) 0%, rgba(0, 160, 233, 0.05) 100%);
    z-index: 0;
}

.gallery-container {
    position: relative;
    z-index: 1;
}

.gallery-title {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    color: var(--gallery-primary);
}

.gallery-title h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.gallery-title h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gallery-accent);
    border-radius: 2px;
}

.gallery-title p {
    font-size: 1.2rem;
    color: #555;
    max-width: 700px;
    margin: 0 auto;
}

.gallery-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
    gap: 10px;
}

.gallery-filter-btn {
    padding: 10px 25px;
    background: transparent;
    border: 2px solid var(--gallery-secondary);
    color: var(--gallery-primary);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.gallery-filter-btn:hover, .gallery-filter-btn.active {
    background: var(--gallery-secondary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 160, 233, 0.3);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    aspect-ratio: 1/1;
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-caption {
    color: white;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

.gallery-caption h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: white;
}

.gallery-caption p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Modal de la galería */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
    color: var(--gallery-accent);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.modal-prev, .modal-next {
    color: white;
    font-size: 3rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-prev:hover, .modal-next:hover {
    background: var(--gallery-secondary);
    transform: scale(1.1);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

.modal-caption {
    position: absolute;
    bottom: -40px;
    left: 0;
    width: 100%;
    text-align: center;
    color: white;
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0 0 5px 5px;
}

/* Efectos especiales */
.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--gallery-secondary) 0%, var(--gallery-primary) 100%);
    opacity: 0;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::before {
    opacity: 0.2;
}

.gallery-item::after {
    content: '\f06e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3rem;
    color: white;
    opacity: 0;
    z-index: 2;
    transition: all 0.3s ease;
}

.gallery-item:hover::after {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
}

/* Responsive */
@media (min-width: 992px) {
    .gallery-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr); /* Exactamente 4 columnas */
        gap: 16px; /* Opcional: espacio entre imágenes */
    }
}


@media (max-width: 992px) {
    .gallery-title h2 {
        font-size: 2.2rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .gallery-section {
        padding: 60px 0;
    }
    
    .gallery-title h2 {
        font-size: 2rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 15px;
    }
    
    .modal-prev, .modal-next {
        width: 50px;
        height: 50px;
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .gallery-section {
        padding: 40px 0;
    }
    
    .gallery-title h2 {
        font-size: 1.8rem;
    }
    
    .gallery-title p {
        font-size: 1rem;
    }
    
    .gallery-filter {
        margin-bottom: 30px;
    }
    
    .gallery-filter-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .modal-close {
        top: -30px;
        font-size: 1.5rem;
    }
    
    .modal-prev, .modal-next {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    
    .modal-caption {
        font-size: 0.9rem;
    }
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }
.gallery-item:nth-child(7) { animation-delay: 0.7s; }
.gallery-item:nth-child(8) { animation-delay: 0.8s; }
.gallery-item:nth-child(9) { animation-delay: 0.9s; }
.gallery-item:nth-child(10) { animation-delay: 1s; }


/* Spinner de carga */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 160, 233, 0.2);
    border-radius: 50%;
    border-top-color: var(--gallery-secondary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    color: #dc3545;
    text-align: center;
    padding: 2rem;
    grid-column: 1/-1;
}

/* Estilos para el indicador de filtrado */
.filter-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 100;
}

.filter-loading .loading-spinner {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.filter-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 160, 233, 0.2);
    border-radius: 50%;
    border-top-color: var(--gallery-secondary);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 10px;
}

.filter-loading p {
    color: var(--gallery-primary);
    font-weight: 600;
    margin: 0;
}

/* Deshabilitar botones durante el filtrado */
.gallery-filter-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}