/* Estilos modernos para la galería */

/* Sección de galería */
#gallery {
    padding: 80px 0;
    background-color: rgba(35,45,57,0.03);
}

/* Estilos para mantener consistencia con otras secciones */
/* Comentado para permitir cambio de tema */
/* #gallery .section-heading h2 {
    color: #232d39;
} */

#gallery .section-heading h2 em {
    color: #ed563b;
    font-style: normal;
}

#gallery .section-heading p {
    color: #7a7a7a;
}

/* Contenedor de galería con grid moderno */
.gallery-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Items de galería mejorados */
.gallery-item-modern {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-item-modern:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(237, 86, 59, 0.3);
}

/* Diferentes tamaños para crear un layout dinámico */
.gallery-item-modern.large {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item-modern.tall {
    grid-row: span 2;
}

.gallery-item-modern.wide {
    grid-column: span 2;
}

/* Imagen con efectos */
.gallery-item-modern img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.gallery-item-modern:hover img {
    transform: scale(1.1);
    opacity: 0.8;
}

/* Overlay con información */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.9) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

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

/* Contenido del overlay */
.gallery-overlay-content {
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.gallery-item-modern:hover .gallery-overlay-content {
    transform: translateY(0);
}

.gallery-overlay h3 {
    color: white;
    font-size: 20px;
    margin-bottom: 5px;
    font-weight: 600;
}

.gallery-overlay p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 0;
}

/* Icono de expansión */
.gallery-expand {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 60px;
    height: 60px;
    background: rgba(237, 86, 59, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.gallery-item-modern:hover .gallery-expand {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-expand i {
    color: white;
    font-size: 24px;
}

/* Animación de entrada */
.gallery-item-modern {
    animation: galleryFadeIn 0.6s ease-out;
    animation-fill-mode: both;
}

@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Delay escalonado para animación */
.gallery-item-modern:nth-child(1) { animation-delay: 0.1s; }
.gallery-item-modern:nth-child(2) { animation-delay: 0.2s; }
.gallery-item-modern:nth-child(3) { animation-delay: 0.3s; }
.gallery-item-modern:nth-child(4) { animation-delay: 0.4s; }
.gallery-item-modern:nth-child(5) { animation-delay: 0.5s; }
.gallery-item-modern:nth-child(6) { animation-delay: 0.6s; }
.gallery-item-modern:nth-child(7) { animation-delay: 0.7s; }
.gallery-item-modern:nth-child(8) { animation-delay: 0.8s; }

/* Responsive */
@media (max-width: 768px) {
    .gallery-modern {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
        padding: 0 15px;
    }
    
    .gallery-item-modern.large,
    .gallery-item-modern.wide {
        grid-column: span 1;
    }
    
    .gallery-item-modern.tall,
    .gallery-item-modern.large {
        grid-row: span 1;
    }
}

/* Lightbox personalizado */
.gallery-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-lightbox-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.gallery-lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Estilos mejorados para botones */
.main-button a,
.btn-primary,
button[type="submit"],
.custom-button {
    display: inline-block;
    background: linear-gradient(135deg, #ed563b 0%, #f09433 100%);
    color: white !important;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(237, 86, 59, 0.3);
}

.main-button a:hover,
.btn-primary:hover,
button[type="submit"]:hover,
.custom-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(237, 86, 59, 0.4);
    color: white !important;
}

.main-button a:active,
.btn-primary:active,
button[type="submit"]:active,
.custom-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(237, 86, 59, 0.3);
}

/* Efecto ripple para botones */
.main-button a::before,
.btn-primary::before,
button[type="submit"]::before,
.custom-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.main-button a:hover::before,
.btn-primary:hover::before,
button[type="submit"]:hover::before,
.custom-button:hover::before {
    width: 300px;
    height: 300px;
}

/* Variantes de botones */
.main-button.secondary a {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.main-button.secondary a:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.main-button.outline a {
    background: transparent;
    border: 2px solid #ed563b;
    color: #ed563b !important;
    box-shadow: none;
}

.main-button.outline a:hover {
    background: #ed563b;
    color: white !important;
    box-shadow: 0 8px 25px rgba(237, 86, 59, 0.4);
}

/* Botón flotante para volver arriba */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ed563b 0%, #f09433 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 5px 20px rgba(237, 86, 59, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(237, 86, 59, 0.5);
}

/* Media queries responsive */
@media (max-width: 991px) {
    .gallery-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 15px;
    }
    
    /* En móvil, desactivar los spans especiales */
    .gallery-item-modern.large,
    .gallery-item-modern.wide {
        grid-column: span 1;
    }
    
    .gallery-item-modern.tall,
    .gallery-item-modern.large {
        grid-row: span 1;
    }
}

@media (max-width: 576px) {
    .gallery-modern {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}