/* Estilos generales */
.titulogaleria {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.titulogaleria::before {
    content: "\1F4F7";
    position: relative;
    font-size: 1.5em;
    opacity: 1;
    margin-right: 10px;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Contenedor principal de la galería */
.galeria-container {
    max-width: 1000px;
    width: 90%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Grid de la galería */
.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Elementos de la galería */
.galeria-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.galeria-item:hover {
    transform: translateY(-5px);
}

.galeria-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.galeria-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 14px;
}

/* Estilos para el visor 360 */
#viewer-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: none;
    overflow: hidden;
    touch-action: none;
}

#close-viewer {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    z-index: 10001;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#close-viewer:hover {
    background: rgba(255,255,255,0.9);
    color: #000;
}

#scene-title {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10001;
    font-size: 18px;
    text-align: center;
    max-width: 90%;
}

/* Controles de navegación */
#controls {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    gap: 20px;
}

#left-control,
#right-control {
    background: rgba(255, 255, 255, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

#left-control:hover,
#right-control:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* Clase para deshabilitar el scroll cuando el visor está abierto */
body.viewer-open {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Asegurar que el contenedor de A-Frame ocupe todo el espacio */
a-scene {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

/* Estilos para el botón de VR */
.vr-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10002;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.vr-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.vr-button i {
    transition: transform 0.3s ease;
}

.vr-button.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Tooltip del botón VR */
.vr-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.vr-button:hover .vr-tooltip {
    opacity: 1;
}

/* Asegurarse de que el botón esté siempre visible */
#vr-button {
    display: flex !important;
    visibility: visible !important;
}

/* Asegurarse de que el botón de VR de A-Frame esté oculto */
.a-enter-vr {
    display: none !important;
}

/* Ajustes para móviles */
@media (max-width: 768px) {
    .vr-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }
}

/* Media queries para responsividad */
@media (max-width: 900px) {
    .galeria-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 600px) {
    .galeria-container {
        padding: 10px;
    }
    
    .galeria-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .galeria-item img {
        height: 120px;
    }
    
    .galeria-caption {
        font-size: 12px;
        padding: 5px;
    }
}