/* ==========================================================================
   1. VARIABLES GLOBALES Y CONFIGURACIÓN
   ========================================================================== */
:root {
    --rojo: #d60000;
    --rojo-oscuro: #a80000;
    --rojo-intenso: #e60000;
    --rojo-hover: #b80000;
    --dorado: #ffcc00;
    --dorado-suave: #f39c12;
    --fondo-oscuro: #111;
    --blanco: #fff;
    --gris-claro: #f8f9fa;
    --gris-texto: #444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gris-claro);
    color: #222;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   2. BARRA DE NAVEGACIÓN (NAVBAR)
   ========================================================================== */
nav {
    background: linear-gradient(90deg, var(--rojo), var(--rojo-oscuro));
    border-bottom: 2px solid var(--rojo-oscuro);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 30px;
    position: sticky; /* Mantiene el nav fijo arriba sin romper el ::after */
    top: 0;
    z-index: 1000;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* Franja inferior morada */
nav::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background-color: #52007b;
}

nav .logo {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--blanco);
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

nav .logo:hover {
    color: var(--dorado);
}

nav img {
    height: 45px;
    margin-left: 15px;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
}

nav ul li {
    margin-left: 25px;
    display: flex;
    align-items: center;
    position: relative;
}

nav ul li a {
    text-decoration: none;
    color: var(--blanco);
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
}

nav ul li a:hover {
    color: #333;
    background: var(--dorado);
}

/* ==========================================================================
   3. MENÚ DE USUARIO & DROPDOWN
   ========================================================================== */
.user-menu > a {
    font-weight: bold;
    color: var(--dorado);
    cursor: pointer;
}

.user-menu .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--blanco);
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    padding: 8px 0;
    z-index: 999;
}

.user-menu .dropdown li {
    padding: 10px 15px;
    color: #333;
    font-size: 0.9rem;
}

.user-menu .dropdown li a {
    color: var(--rojo);
    display: block;
    padding: 8px 12px;
    border-radius: 5px;
}

.user-menu .dropdown li a:hover {
    background: var(--dorado);
    color: #333;
}

.user-menu:hover .dropdown {
    display: block;
}

/* ==========================================================================
   4. SECCIÓN NOTICIAS & TARJETAS
   ========================================================================== */
#lista-noticias{
    padding: 60px 25px;
    background:
    linear-gradient(
        to bottom,
        #f7f7f7,
        #ececec
    );
}

/* TITULO */
#lista-noticias h2{

    position: relative;

    text-align: center;

    font-size: 2.7rem;

    font-weight: 900;

    margin-bottom: 55px;

    background: linear-gradient(
        90deg,
        #ff0000 0%,
        #d1003f 45%,
        #52007b 100%
    );

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

    text-transform: uppercase;

    letter-spacing: 1px;
}

/* SUBRAYADO MODERNO */
#lista-noticias h2::after{

    content: "";

    position: absolute;

    left: 50%;

    bottom: -14px;

    transform: translateX(-50%);

    width: 180px;

    height: 6px;

    border-radius: 50px;

    background: linear-gradient(
        90deg,
        #ff0000,
        #52007b
    );

    box-shadow:
    0 0 12px rgba(255,0,0,.45),
    0 0 20px rgba(82,0,123,.35);
}

/* GRID */
#contenedor-noticias{
    width: 100%;
    max-width: 1400px;
    margin: auto;
    display: grid;
    grid-template-columns:
    repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
}

/* CARD */
.noticia-card{
    background: rgba(255,255,255,.96);
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition:
    transform .35s ease,
    box-shadow .35s ease;
    box-shadow:
    0 10px 30px rgba(0,0,0,.10);
    border:
    1px solid rgba(255,255,255,.4);
    backdrop-filter: blur(10px);
    min-height: 100%;
}

/* EFECTO HOVER */
.noticia-card:hover{
    transform:
    translateY(-8px);
    box-shadow:
    0 18px 40px rgba(0,0,0,.16);
}

/* IMAGEN */
.noticia-card img{
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: transform .5s ease;
}
.noticia-card:hover img{
    transform: scale(1.05);
}

/* TITULO */
.noticia-card h3{
    font-size: 1.45rem;
    line-height: 1.45;
    font-weight: 900;
    padding:
    22px 22px 12px;
    background: linear-gradient(
        90deg,
        #d50000 0%,
        #b3004b 45%,
        #52007b 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 110px;
    letter-spacing: -.3px;
}

/* RESUMEN */
.noticia-card p{
    padding:
    0 20px;
    color: #555;
    font-size: 1rem;
    line-height: 1.8;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    min-height: 120px;
}

/* BOTON */
.btn-ver-mas{
    margin: 20px;
    padding:
    13px 22px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    color: white;
    background:
    linear-gradient(
        45deg,
        #bf0404,
        #52007b
    );
    width: fit-content;
    transition:
    transform .3s ease,
    box-shadow .3s ease;
    box-shadow:
    0 6px 18px rgba(0,0,0,.18);
}

/* HOVER BOTON */
.btn-ver-mas:hover{
    transform:
    scale(1.06);
    box-shadow:
    0 10px 25px rgba(0,0,0,.25);
}

/* BOTON FILTRAR */
#btnFiltrar{
    display: block;
    margin:
    0 auto 45px;
    padding:
    14px 28px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .5px;
    color: white;
    cursor: pointer;
    background:
    linear-gradient(
        45deg,
        #52007b,
        #bf0404
    );
    transition:
    transform .3s ease,
    box-shadow .3s ease;
    box-shadow:
    0 8px 20px rgba(0,0,0,.20);
}

#btnFiltrar:hover{
    transform:
    translateY(-4px);
    box-shadow:
    0 14px 28px rgba(0,0,0,.26);
}

/* ==========================================================================
   5. ESTRUCTURA BASE DE MODALES
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999; /* z-index unificado más alto para evitar superposiciones */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
}

.modal-contenido {
    margin: 5% auto;
    padding: 25px;
    border-radius: 15px;
    color: #fff;
    box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.6);
}

.modal-contenido .cerrar {
    float: right;
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    transition: color 0.3s ease;
}

/* --- 5.1 Modal de Filtros (Especificidad) --- */
#modalFiltro .modal-contenido {
    background: linear-gradient(145deg, #52007b, #bf0404);
    margin-top: 10%;
    padding: 30px 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    font-family: 'Arial', sans-serif;
    border: 2px solid #fff;
    position: relative;
    animation: modalEntry 0.4s ease-out;
}

#modalFiltro .modal-contenido h2 {
    margin: 0;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

#modalFiltro .modal-contenido .cerrar {
    position: absolute;
    right: 15px;
    top: 15px;
}

#modalFiltro .modal-contenido .cerrar:hover {
    color: #ffeb3b;
}

#modalFiltro select {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border-radius: 10px;
    border: none;
    font-size: 16px;
}

#btnAplicarFiltro {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, #52007b, #bf0404);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#btnAplicarFiltro:hover {
    background: linear-gradient(45deg, #bf0404, #52007b);
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* --- 5.2 Modal Formularios / Agregar Noticia --- */
#formulario, 
.modal .modal-contenido:not(#modalFiltro .modal-contenido) {
    background: #c70000;
    border: 3px solid #000;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    color: #fff;
    box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.6);
}

/* Animaciones de modales */
@keyframes modalEntry {
    0% { transform: translateY(-50px) scale(0.8); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes aparecer {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.modal-contenido:not(#modalFiltro .modal-contenido) {
    animation: aparecer 0.5s ease;
}

.modal-contenido .cerrar:hover {
    color: #000;
}

/* ==========================================================================
   6. COMPONENTES DE FORMULARIO DE NOTICIAS
   ========================================================================== */
#formulario {
    max-width: 600px;
    margin: 30px auto;
    padding: 25px;
    position: relative;
    animation: flotar 3s ease-in-out infinite;
}

@keyframes flotar {
    0%   { transform: translateY(0px); }
    50%  { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

#formulario h2 {
    text-align: center;
    color: #fff;
    margin-bottom: 20px;
    text-shadow: 2px 2px 5px #000;
}

#form-noticia .form-group {
    margin-bottom: 15px;
}

#form-noticia label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 3px #000;
}

#form-noticia input,
#form-noticia textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #000;
    border-radius: 8px;
    background: #fff;
    color: #000;
    font-size: 1rem;
    margin-bottom: 12px;
}

#form-noticia button {
    display: block;
    width: 100%;
    padding: 12px;
    background: #000;
    color: #fff;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s ease;
}

#form-noticia button:hover {
    background: #fff;
    color: #c70000;
    border: 2px solid #000;
}

#abrirFormulario {
    background: #c70000;
    color: #fff;
    font-weight: bold;
    padding: 12px 20px;
    border: 2px solid #000;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s ease;
}

#abrirFormulario:hover {
    background: #fff;
    color: #c70000;
}

/* ==========================================================================
   7. SECCIÓN FOOTER
   ========================================================================== */
.footer {
    background-color: #b30000;
    border-top: 8px solid #52007b;
    color: #fff;
    padding: 40px 20px 10px;
    font-family: "Poppins", sans-serif;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.3);
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    text-align: center;
    gap: 30px;
}

.footer-column {
    flex: 1 1 250px;
    max-width: 300px;
}

.footer h4 {
    color: #ffcc00;
    font-size: 1.2rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    border-bottom: 2px solid #fff;
    display: inline-block;
    padding-bottom: 4px;
}

.footer p,
.footer a {
    color: #f5f5f5;
    font-size: 0.95rem;
    line-height: 1.6;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease;
}

.footer a:hover {
    color: #ffcc00;
    transform: translateX(3px);
}

.footer-slogan {
    font-style: italic;
    color: #f0f0f0;
    margin-top: 5px;
}

/* Redes Sociales */
.social-icons {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.social-icons li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #52007b;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.social-icons li a i {
    color: #ffcc00;
    font-size: 18px;
}

.social-icons li a:hover {
    background-color: #ffcc00;
    border-color: #fff;
    transform: scale(1.1);
}

.social-icons li a:hover i {
    color: #52007b;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 15px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #f0f0f0;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   8. MEDIA QUERIES (SOPORTE RESPONSIVO CONSOLIDADO)
   ========================================================================== */
@media (max-width: 768px) {
    /* Menú Hamburguesa en Móvil */
    nav ul {
        flex-direction: column;
        display: none;
        background-color: #222;
        position: absolute;
        top: 70px;
        right: 20px;
        width: 220px;
        border-radius: 8px;
        padding: 15px 0;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }

    nav ul.active {
        display: flex;
        animation: fadeIn 0.4s ease;
    }

    nav ul li {
        margin: 12px 0;
        text-align: center;
    }

    .menu-toggle {
        display: block; /* Muestra el botón hamburguesa correctamente */
        background: none;
        border: none;
        color: var(--blanco);
        font-size: 1.8rem;
        cursor: pointer;
        z-index: 1001;
    }

    /* Ajustes del Footer */
    .footer-container {
        flex-direction: column;
        align-items: center;
    }

    .footer-column {
        max-width: 100%;
    }

    .social-icons {
        justify-content: center;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}