/**
 * Galería Quiet Luxury - Kenkatsu
 * Diseño minimalista y elegante para mostrar las instalaciones
 * 
 * @package KenkatsuTheme
 * @version 2.0
 */

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --gallery-spacing: 2rem;
    --gallery-gap: 1.5rem;
    --gallery-overlay-bg: rgba(0, 0, 0, 0.7);
    --gallery-text-color: #FFFFFF;
    --gallery-accent: var(--kenkatsu-teal);
    --gallery-bg-light: #FAFAF9;
    --gallery-border: rgba(0, 0, 0, 0.08);
}

/* ============================================
   FILTROS
   ============================================ */
.kenkatsu-gallery-filters {
    padding: 4rem 0 2rem;
    background: var(--gallery-bg-light);
    border-bottom: 1px solid var(--gallery-border);
}

.gallery-filter-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--gallery-border);
    border-radius: 50px;
    color: var(--kenkatsu-dark);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--kenkatsu-teal);
    transition: left 0.3s ease;
    z-index: 0;
}

.filter-btn span {
    position: relative;
    z-index: 1;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--kenkatsu-teal);
    color: #FFFFFF;
}

.filter-btn.active::before,
.filter-btn:hover::before {
    left: 0;
}

.filter-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.filter-btn.active .filter-count,
.filter-btn:hover .filter-count {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   GRID DE GALERÍA
   ============================================ */
.kenkatsu-gallery-main {
    padding: 4rem 0;
    background: #FFFFFF;
}

.gallery-grid-quiet-luxury {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--gallery-gap);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.gallery-item {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.4s ease;
    animation: fadeInUp 0.6s ease forwards;
}

/* Ocultar de la cuadrícula para que el grid refluya y las fotos queden arriba */
.gallery-item.hidden {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item-inner {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Aspect ratio 1:1 */
    overflow: hidden;
    background: var(--gallery-bg-light);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-inner:hover {
    transform: translateY(-4px);
}

.gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-inner:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    z-index: 2;
}

.gallery-item-inner:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    width: 100%;
}

.gallery-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gallery-text-color);
    margin: 0 0 0.25rem 0;
    line-height: 1.4;
}

.gallery-item-category {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* Variaciones de tamaño para crear interés visual */
.gallery-item:nth-child(3n) .gallery-item-inner {
    padding-bottom: 120%;
}

.gallery-item:nth-child(5n) .gallery-item-inner {
    padding-bottom: 80%;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.gallery-lightbox-quiet-luxury {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-lightbox-quiet-luxury.active {
    display: flex;
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 98vw;
    max-height: 98vh;
    display: grid;
    grid-template-columns: 72px 1fr 72px;
    align-items: center;
    justify-items: center;
    gap: 0.75rem;
    padding: 0 0.5rem;
}

/* Contenido central: imagen + texto visibles de un vistazo */
.lightbox-image-wrapper {
    position: relative;
    max-height: 98vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-column: 2;
    min-height: 0;
}

.lightbox-image {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 100%;
    max-height: calc(98vh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
    flex-shrink: 0;
    margin-top: 0.75rem;
    padding-bottom: 0.5rem;
    text-align: center;
    color: #FFFFFF;
}

/* Columnas laterales: solo el ancho del botón, pegados a la imagen */
.lightbox-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
}
.lightbox-nav-prev { grid-column: 1; justify-self: end; }
.lightbox-nav-next { grid-column: 3; justify-self: start; }

.lightbox-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #FFFFFF;
}

.lightbox-category {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Botón cerrar: fijo en esquina superior derecha del viewport */
.lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1000000;
    width: 52px;
    height: 52px;
    padding: 0;
    border: none;
    box-sizing: border-box;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--kenkatsu-dark, #1a1a1a);
    transform: scale(1.05);
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.35);
}

/* Botones prev/next: centrados en columnas laterales, estilo premium */
.lightbox-prev,
.lightbox-next {
    width: 56px;
    height: 56px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.2s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--kenkatsu-teal, #0d9488);
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Iconos centrados dentro del círculo: sin padding extra, SVG bloque */
.lightbox-close svg,
.lightbox-prev svg,
.lightbox-next svg {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    display: block;
    margin: 0;
    stroke-width: 2.25;
    stroke: currentColor;
}
.lightbox-prev svg,
.lightbox-next svg {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
}
.lightbox-close svg line,
.lightbox-prev svg polyline,
.lightbox-next svg polyline {
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* ============================================
   MENSAJE SIN RESULTADOS
   ============================================ */
.gallery-no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--kenkatsu-gray);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .gallery-grid-quiet-luxury {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .gallery-filter-nav {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .lightbox-container {
        grid-template-columns: 56px 1fr 56px;
        gap: 0.5rem;
    }
    
    .lightbox-nav {
        width: 56px;
    }
    
    .lightbox-image {
        max-height: calc(98vh - 90px);
    }
    
    .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 48px;
        height: 48px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 48px;
        height: 48px;
    }
    
    .lightbox-close svg {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }
    
    .lightbox-prev svg,
    .lightbox-next svg {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
    }
}

@media (max-width: 480px) {
    .gallery-grid-quiet-luxury {
        grid-template-columns: 1fr;
    }
    
    .gallery-filter-nav {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-btn {
        justify-content: center;
    }
}
