/* ==========================================
   BLOQUE GALERÍA Y CARRUSEL
   ========================================== */
.bloque-galeria {
    width: 100%;
    padding: 20px 0;
}

.sede-galeria-contenedor {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px; /* Espacio para las flechas */
}

/* Viewport deslizable */
.sede-galeria-viewport {
    overflow-x: auto;
    scroll-behavior: smooth;
    width: 100%;
    /* Ocultar barra de desplazamiento */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
}

.sede-galeria-viewport::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Contenedor flexible de fotos */
/* Contenedor flexible de fotos */
.sede-galeria {
    display: flex;
    gap: 16px;
    align-items: center;
    
    /* SOLUCIÓN: Usamos "safe center". Si el contenido cabe, se centra. 
       Si el contenido se desborda, se alinea al inicio para no ocultar la primera imagen. */
    justify-content: safe center;
    
    min-width: 100%;
    padding: 10px 0;
}

/* Elemento individual de la galería */
.sede-galeria-foto-2 {
    flex: 0 0 auto;
    width: 280px; /* Ancho base por tarjeta */
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sede-galeria-foto-2:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.sede-galeria-foto-2 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Flechas de navegación */
.sede-flecha {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.sede-flecha:hover {
    background: rgba(0, 0, 0, 0.9);
}

.sede-flecha.izquierda { left: 0; }
.sede-flecha.derecha { right: 0; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .sede-galeria-contenedor {
        padding: 0 30px;
    }
    
    .sede-galeria-foto-2 {
        width: 220px;
        height: 160px;
    }
    
    .sede-flecha {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* ==========================================
   POPUP / MODAL DINÁMICO
   ========================================== */
.galeria-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9999;
    padding: 20px;
}

.galeria-modal.active {
    opacity: 1;
    visibility: visible;
}

.galeria-modal-contenido {
    background: #fff;
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.galeria-modal-cerrar {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    z-index: 10;
}

.galeria-modal-body {
    display: flex;
    flex-direction: column;
}

.galeria-modal-imagen-container {
    width: 100%;
    max-height: 70vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.galeria-modal-imagen-container img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.galeria-modal-info {
    padding: 20px;
}

.galeria-modal-titulo {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #1a202c;
}

.galeria-modal-descripcion {
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.5;
}

/* Loader para la carga del endpoint */
.galeria-modal-loader {
    text-align: center;
    padding: 15px;
    color: #666;
    font-style: italic;
}

/* ===================================================
   MODIFICADORES DE TAMAÑO / FORMATO POR GALERÍA
   =================================================== */

/* 1. Formato Vertical / Retrato (ej. 3:4 o 9:16) */
.bloque-galeria--vertical .sede-galeria-foto-2 {
    width: 200px;
    height: 300px;
}
/* FORMA DE USO: <section class="bloque-galeria bloque-galeria--vertical"> */

/* 2. Formato Panorámico / Ancho */
.bloque-galeria--panoramico .sede-galeria-foto-2 {
    width: 380px;
    height: 180px;
}
/* FORMA DE USO: <section class="bloque-galeria bloque-galeria--panoramico"> */

/* 3. Formato Cuadrado (1:1 - estilo Instagram) */
.bloque-galeria--cuadrado .sede-galeria-foto-2 {
    width: 220px;
    height: 220px;
}
/* FORMA DE USO: <section class="bloque-galeria bloque-galeria--cuadrado"> */


.bloque-galeria--planes-index .sede-galeria-foto-2 {
    width: 380px;
    height: 480px;
}

.bloque-galeria--clinicas-asociadas .sede-galeria-foto-2 {
    width: 420px;
    height: 300px;
}