/**
 * Media Gallery Tabs - Estilos
 * Diseño masonry con diferentes tamaños de imagen y lightbox
 */

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.media-gallery-tabs-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   NAVEGACIÓN DE TABS
   ======================================== */
.gallery-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 12px 30px;
    background: transparent;
    border: 2px solid #074940;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #074940;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab-button:hover {
    background: #074940;
    color: white;
    border-color: #074940;
    transform: translateY(-2px);
}

.tab-button.active {
    background: #074940;
    color: white;
    border-color: #074940;
    box-shadow: 0 4px 15px rgba(7, 73, 64, 0.4);
}

/* ========================================
   CONTENIDO DE TABS
   ======================================== */
.gallery-tabs-content {
    position: relative;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   GALERÍA MASONRY
   ======================================== */
.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 220px;
    gap: 15px;
    grid-auto-flow: dense;
    width: 100%;
}

/* Diferentes tamaños de elementos - respetando el grid */
.gallery-item-large {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item-medium {
    grid-column: span 1;
    grid-row: span 2;
}

.gallery-item-small {
    grid-column: span 1;
    grid-row: span 1;
}

/* ========================================
   ITEMS DE GALERÍA
   ======================================== */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Overlay con efecto hover */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 73, 64, 0.75);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-icon {
    color: white;
    font-size: 40px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ========================================
   LIGHTBOX
   ======================================== */
.gallery-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px 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;
    }
}

/* Botones del lightbox */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 40px;
    line-height: 1;
}

.lightbox-prev {
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-title {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 16px;
    backdrop-filter: blur(10px);
    max-width: 80%;
    text-align: center;
}

/* ========================================
   MENSAJES
   ======================================== */
.no-images {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
    font-style: italic;
}

.media-gallery-error {
    background: #fff3e0;
    color: #074940;
    padding: 15px 20px;
    border-left: 4px solid #074940;
    border-radius: 4px;
    margin: 20px 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .masonry-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        grid-auto-rows: 180px;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .masonry-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-auto-rows: 150px;
        gap: 10px;
    }
    
    .gallery-item-large {
        grid-column: span 2;
        grid-row: span 1;
    }
    
    .tab-button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .masonry-gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 120px;
    }
    
    .gallery-item-large,
    .gallery-item-medium {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    .gallery-tabs-nav {
        gap: 8px;
    }
    
    .tab-button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .lightbox-title {
        font-size: 14px;
        padding: 10px 20px;
        bottom: 15px;
    }
}

/* ========================================
   MODO OSCURO (OPCIONAL)
   ======================================== */
@media (prefers-color-scheme: dark) {
    .tab-button {
        background: #2a2a2a;
        border-color: #444;
        color: #ddd;
    }
    
    .tab-button:hover {
        background: #333;
        border-color: #555;
    }
    
    .gallery-tabs-nav {
        border-bottom-color: #444;
    }
}
