/* Reset básico para el iframe */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    /* overflow: hidden; ELIMINADO para permitir gesto de ZOOM nativo en móviles */
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #f4f6f9;
    touch-action: auto; /* Asegura que el navegador procese gestos nativos (pinch) */
}

/* Contenedor principal para forzar formato cuadrado si se incrusta directo o se abre en pantalla completa */
.muro-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* overflow: hidden; ELIMINADO para habilitar zoom */
    background-color: #000; /* Fondo negro para que las imágenes resalten */
}

/* ========================================================
   LOADER (Pantalla de carga original del EJEMPLO)
   ======================================================== */
.center-loader-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #3E1E68;
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.center-loader-container.fade-out {
    opacity: 0;
}

.loader-text {
    font-family: Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: 300;
    color: #ffffff;
    letter-spacing: 2px;
}

.center-loader-container .background {
    width: 100%;
    height: 100%;
    background: #3E1E68;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.center-loader-container .background span {
    width: 8vmin;
    height: 8vmin;
    border-radius: 8vmin;
    backface-visibility: hidden;
    position: absolute;
    animation-name: move;
    animation-duration: 7.8s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.center-loader-container .background span:nth-child(1) {
    color: #583C87;
    top: 15%; left: 15%;
    animation-duration: 19.89s;
    animation-delay: -10.5s;
    transform-origin: -6vw -4vh;
    box-shadow: 15vmin 0 2vmin currentColor;
}
.center-loader-container .background span:nth-child(2) {
    color: #FFACAC;
    top: 75%; left: 15%;
    animation-duration: 18.33s;
    animation-delay: -4.2s;
    transform-origin: 3vw 8vh;
    box-shadow: -15vmin 0 4vmin currentColor;
}
.center-loader-container .background span:nth-child(3) {
    color: rgb(107, 204, 149);
    top: 15%; left: 85%;
    animation-duration: 18.07s;
    animation-delay: -9s;
    transform-origin: 2vw 1vh;
    box-shadow: 15vmin 0 5vmin currentColor;
}
.center-loader-container .background span:nth-child(4) {
    color: #FFACAC;
    top: 80%; left: 85%;
    animation-duration: 20.15s;
    animation-delay: -2.7s;
    transform-origin: -4vw 6vh;
    box-shadow: -15vmin 0 4vmin currentColor;
}
.center-loader-container .background span:nth-child(5) {
    color: #583C87;
    top: 50%; left: 90%;
    animation-duration: 19.24s;
    animation-delay: -3.7s;
    transform-origin: -3vw 1vh;
    box-shadow: 15vmin 0 3vmin currentColor;
}

@keyframes move {
    100% {
        transform: translate3d(0, 0, 1px) rotate(360deg);
    }
}
.center-loader-container .loader,
.center-loader-container .loader-text {
    position: relative;
    z-index: 2;
}

/* ========================================================
   FEED (Muro) - Scroll horizontal magnético
   ======================================================== */
.muro-feed-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

.muro-feed-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* Ocultar scrollbar estándar en navegadores webkit */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.muro-feed-container::-webkit-scrollbar {
    display: none;
}

.muro-item {
    min-width: 100%;
    width: 100%;
    height: 100%; /* Cambiado a 100% para scroll horizontal */
    scroll-snap-align: start;
    scroll-snap-stop: always; /* Obliga a frenar en cada diapositiva */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden; /* Fundamental para contener el blur amplificado */
}

/* El fondo difuminado (Ambient Mode) */
.muro-item-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    /* Difuminado pesado y oscurecido para no opacar la foto real */
    filter: blur(25px) brightness(0.6);
    /* Escala inicial y animación de Ken Burns */
    transform: scale(1.15);
    animation: ambient-ken-burns 20s ease-in-out infinite alternate;
    z-index: 1;
}

@keyframes ambient-ken-burns {
    0% {
        transform: scale(1.15) translate(0, 0);
    }
    100% {
        transform: scale(1.3) translate(-2%, 2%);
    }
}

.muro-item img {
    position: relative;
    z-index: 2; /* Siempre por encima del fondo difuminado */
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: transparent;
    /* Sutil sombra para separarlo del fondo como si flotara */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    touch-action: pan-x pan-y pinch-zoom; /* Permitir explícitamente el gesto de zoom */
}

/* Controles de navegación */
.nav-chevron {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(90, 44, 130, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s, transform 0.3s;
}

.nav-chevron:hover {
    background: rgba(90, 44, 130, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.nav-chevron.left-chevron {
    left: 10px;
}

.nav-chevron.right-chevron {
    right: 10px;
}

.hidden {
    display: none !important;
}

@keyframes pulse-animation {
    0% { transform: translateY(-50%) scale(1); box-shadow: 0 0 0 0 rgba(90, 44, 130, 0.7); }
    70% { transform: translateY(-50%) scale(1.1); box-shadow: 0 0 0 10px rgba(90, 44, 130, 0); }
    100% { transform: translateY(-50%) scale(1); box-shadow: 0 0 0 0 rgba(90, 44, 130, 0); }
}

.nav-chevron.pulse {
    animation: pulse-animation 2s infinite;
}

.nav-chevron.pulse:hover {
    animation: none;
    transform: translateY(-50%) scale(1.1);
}

@keyframes pulse-loading-text {
    0% { opacity: 0.3; transform: scale(0.99); }
    50% { opacity: 1; transform: scale(1.01); }
    100% { opacity: 0.3; transform: scale(0.99); }
}

.pulse-loading-text {
    animation: pulse-loading-text 3s ease-in-out infinite;
}

/* Paginación superior */
.muro-pagination {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 20;
    pointer-events: none;
}

/* En fullscreen, la paginación sube un poco para no superponerse con los controles */
body.is-tiktok-mode .muro-pagination {
    top: 5px;
}

.muro-pagination .dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transition: background-color 0.3s, transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.muro-pagination .dot.active {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.3);
}

.empty-feed {
    color: #fff;
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* ========================================================
   CONTROLES (Botón Maximizar)
   ======================================================== */
.muro-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 60;
}

/* Botón de Enlace Flotante en slides individuales */
.muro-link-btn {
    position: absolute;
    bottom: 60px;
    right: 10px;
    background-color: rgba(90, 44, 130, 0.9);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    text-decoration: none;
    z-index: 40;
}

.muro-link-btn:hover {
    background-color: rgba(90, 44, 130, 1);
    transform: scale(1.1);
}

.muro-link-btn.pulse {
    animation: pulse-animation 2s infinite;
}

.muro-btn {
    background-color: rgba(90, 44, 130, 0.85); /* #5a2c82 con opacidad */
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.muro-btn:hover {
    background-color: rgba(90, 44, 130, 1);
    transform: scale(1.05);
}

/* Animación Jelly Wobble Sutil para Hover */
@keyframes jelly-wobble-subtle {
    0%   { transform: scale(1, 1); }
    30%  { transform: scale(1.1, 0.9); }
    40%  { transform: scale(0.9, 1.1); }
    50%  { transform: scale(1.05, 0.95); }
    65%  { transform: scale(0.98, 1.02); }
    75%  { transform: scale(1.02, 0.98); }
    100% { transform: scale(1, 1); }
}

/* --- TIKTOK MODE (FULLSCREEN VERTICAL SCROLL) SOLO PARA MOBILE --- */
@media (max-width: 768px) {
    .is-tiktok-mode .muro-feed-container {
        flex-direction: column !important;
        overflow-x: hidden !important;
        overflow-y: scroll !important;
        scroll-snap-type: y mandatory !important;
    }
    
    .is-tiktok-mode .muro-item {
        height: 100vh !important;
        min-height: 100vh !important;
        flex: 0 0 100vh !important;
    }

    .is-tiktok-mode .nav-chevron {
        display: none !important;
    }

    /* Indicador de scroll inicial (flecha pulsante) */
    .tiktok-scroll-indicator {
        display: none; /* Oculto por defecto, JS lo muestra */
    }
    .is-tiktok-mode .tiktok-scroll-indicator {
        display: flex;
        position: absolute;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.8);
        z-index: 1000;
        animation: pulse-scroll 2s infinite;
        pointer-events: none;
        filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.5));
    }
    @keyframes pulse-scroll {
        0% { transform: translate(-50%, 0); opacity: 0.8; }
        50% { transform: translate(-50%, 15px); opacity: 0.3; }
        100% { transform: translate(-50%, 0); opacity: 0.8; }
    }
    /* Clase que aplica JS para matarlo para siempre */
    .tiktok-scroll-indicator.hidden-forever {
        display: none !important;
    }
}

.jelly-wobble-hover:hover {
    animation: jelly-wobble-subtle 0.6s cubic-bezier(0.5, 1.5, 0.8, 1.2) both;
}

/* Badge para llamados a concurso */
.muro-badge-llamado {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background-color: rgba(90, 44, 130, 0.95);
    color: white;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    z-index: 40;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    border: 2px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    letter-spacing: 0.5px;
}

/* Posición original (arriba) en fullscreen */
body.is-tiktok-mode .muro-badge-llamado {
    top: 75px;
    bottom: auto;
}

/* ========================================================
   ZOOM + PAN
   ======================================================== */

/* Botón zoom deshabilitado (lupa - al inicio) */
.muro-btn--zoom:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Imagen en modo zoom: permite panear, transform se aplica desde JS */
.muro-item img.zoom-active {
    cursor: grab;
    touch-action: none; /* JS toma control total del gesto */
    will-change: transform;
    transition: transform 0.15s ease-out;
    object-fit: contain; /* Mantiene proporción original */
}

.muro-item img.zoom-active:active {
    cursor: grabbing;
}

/* Cuando hay zoom activo, el contenedor de feed no scrollea con drag */
.muro-feed-container.zoom-locked {
    overflow: hidden;
    scroll-snap-type: none;
    pointer-events: none; /* El click pasa directo a la imagen */
}

/* La imagen recupera pointer-events aunque el container esté bloqueado */
.muro-feed-container.zoom-locked .muro-item img {
    pointer-events: auto;
}
