/* ==========================================================================
   COMPONENTES DE ANUNCIOS (POPUP Y HERO)
   ========================================================================== */

/* --- 1. POPUP DE ANUNCIO --- */
.muni-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.muni-popup-content {
    position: relative;
    max-width: 800px;
    width: 90%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: popupFadeIn 0.4s ease-out forwards;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.muni-popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.muni-popup-close-btn:hover {
    background: #e53e3e; /* Rojo */
}

.muni-popup-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80vh;
    object-fit: cover;
}

.muni-popup-no-img {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.muni-popup-no-img h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}


/* --- 2. HERO ANUNCIO DESTACADO --- */
.anuncio-hero-section {
    position: relative;
    width: 100%;
    background-color: #0549BD;
}

.anuncio-hero-link {
    display: block;
    width: 100%;
    height: 100%; /* Fix para asegurar que el height no colapse */
    text-decoration: none;
    overflow: hidden;
    position: relative;
}

.anuncio-hero-bg {
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.5s ease;
    position: relative; /* Para posicionar el contenido hijo */
}

@media (min-width: 768px) {
    .anuncio-hero-bg {
        height: 500px; /* Más grande en desktop */
    }
}

@media (min-width: 1200px) {
    .anuncio-hero-bg {
        height: 600px; /* Pantalla completa en pantallas grandes */
    }
}

.anuncio-hero-link:hover .anuncio-hero-bg {
    transform: scale(1.02);
}

/* Nuevo contenedor de contenido para título sobre imagen */
.anuncio-hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem 2rem 4rem 2rem; /* Más padding inferior por los dots del carrusel */
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
}

.anuncio-hero-title {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    max-width: 80%;
}

.anuncio-hero-bg.no-bg {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    text-align: center;
    padding: 2rem;
}

.anuncio-hero-bg.no-bg .anuncio-hero-content {
    position: relative;
    background: transparent;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.anuncio-hero-fallback-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@media (max-width: 767px) {
    .anuncio-hero-title {
        font-size: 1.5rem;
        max-width: 100%;
    }
    .anuncio-hero-content {
        padding: 1.5rem 1.5rem 3rem 1.5rem;
    }
    .anuncio-hero-fallback-title {
        font-size: 1.8rem;
    }
}

/* --- 3. CARRUSEL ANUNCIOS HERO --- */
.anuncio-hero-section {
    position: relative;
    width: 100%;
    background-color: #0549BD; /* Azul institucional exacto de la sección Hero */
    padding: 2rem 0 1rem 0; /* Espaciado superior e inferior para integrarse perfectamente */
}

.anuncio-hero-section.has-carousel {
    /* Mantiene las propiedades existentes pero habilita lógica de carrusel */
}

.anuncio-hero-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 20px; /* Bordes redondeados acordes al diseño de las tarjetas */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); /* Sombra suave */
}

.anuncio-hero-track {
    position: relative;
    width: 100%;
    height: 400px; /* Igual que .anuncio-hero-bg base */
}

@media (min-width: 768px) {
    .anuncio-hero-track { height: 500px; }
}

@media (min-width: 1200px) {
    .anuncio-hero-track { height: 600px; }
}

.anuncio-hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
    z-index: 1;
}

.anuncio-hero-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* Redefinir .anuncio-hero-bg dentro del slide para que tome altura total */
.anuncio-hero-slide .anuncio-hero-bg {
    height: 100%;
}

/* Controles de navegación */
.anuncio-hero-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.anuncio-hero-control:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.anuncio-hero-control:active {
    transform: translateY(-50%) scale(0.95);
}

.anuncio-hero-control.prev {
    left: 20px;
}

.anuncio-hero-control.next {
    right: 20px;
}

@media (max-width: 768px) {
    .anuncio-hero-control {
        width: 36px;
        height: 36px;
        left: 10px;
    }
    .anuncio-hero-control.next {
        right: 10px;
        left: auto;
    }
}

/* Indicadores (Dots) */
.anuncio-hero-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
}

.anuncio-hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.anuncio-hero-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.anuncio-hero-dot.active {
    background: white;
    width: 24px;
    border-radius: 6px;
}
