/* ============================================ */
/* VARIABLES LOCALES PARA CATEGORIA.PHP         */
/* ============================================ */
:root {
    --borde-tarjeta: #e2e8f0;
    --fondo-etiqueta: #cfd0d0;
    --texto-etiqueta: #1e3a8a;
    --texto-secundario: #64748b;
    --texto-resumen: #475569;
    --color-enlace: #3b82f6;
    --color-accion: #06b6d4;
    
    /* Gradientes Neón importados del Index */
    --uiverse-gradiente: linear-gradient(163deg, #dde4ff 0%, #bfc5ce 100%);
    --uiverse-shadow: rgba(122, 140, 243, 0.4);
}

body.dark-mode {
    --borde-tarjeta: #4b5563; 
    --fondo-etiqueta: rgba(0, 102, 255, 0.2); 
    --texto-etiqueta: #4ade80; 
    --texto-secundario: #9ca3af; 
    --texto-resumen: #f3f4f6; 
    --color-enlace: #60a5fa; 
    
    /* Gradiente oscuro */
    --uiverse-gradiente: linear-gradient(163deg, #8097906a 0%, #807d7d6e 100%);
    --uiverse-shadow: rgba(255, 255, 255, 0.1);
}

/* ============================================ */
/* CABECERA DINÁMICA CON PATRÓN HALFTONE        */
/* ============================================ */
.categoria-header-full {
    width: 100%;
    /* Fondo azul principal pedido por el usuario */
    background: #053d96; 
    border-bottom: 1px solid var(--borde-tarjeta);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 40px;
    padding: 50px 20px;
    text-align: center;
    box-sizing: border-box;
    position: relative;
    overflow: hidden; 
    transition: background 0.3s, border-color 0.3s;
}

body.dark-mode .categoria-header-full {
    background: #021a42; /* Azul más oscuro para el modo noche */
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* 1. PATRÓN DE PUNTOS (HALFTONE UIVERSE) */
.categoria-header-full::before {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    /* Puntos de color claro/cian */
    background: radial-gradient(rgba(6, 182, 212, 0.4), transparent) 0 0/1.5em 1.5em space;
    /* Máscara que hace que desaparezcan hacia abajo */
    -webkit-mask: linear-gradient(rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 0));
    mask: linear-gradient(rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 0));
    z-index: 1;
    pointer-events: none;
}

body.dark-mode .categoria-header-full::before {
    background: radial-gradient(rgba(59, 130, 246, 0.3), transparent) 0 0/1.5em 1.5em space;
}

/* 2. LUCES FLOTANTES (GLOWS) */
.categoria-header-full::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1); 
    border-radius: 50%;
    filter: blur(80px);
    -webkit-filter: blur(80px);
    pointer-events: none;
    top: -100px;
    left: 20%;
    z-index: 0; 
}

/* --- TEXTOS DEL HERO --- */
/* (Invertimos los colores de título y descripción porque ahora el fondo es oscuro) */

.volver {
    display: inline-block;
    margin-bottom: 20px;
    color: #93c5fd; /* Azul más claro para que resalte sobre el fondo oscuro */
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.3s;
    position: relative;
    z-index: 5; 
}

.volver:hover {
    color: #fff;
    text-decoration: underline;
}

.titulo-categoria-full {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 5; 
}

.titulo-categoria-full h1 {
    color: #ffffff; /* Letra blanca por el fondo azul */
    font-size: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 0 0 15px 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3); /* Sombra para mejor lectura */
}

.titulo-categoria-full h1 i {
    color: #22d3ee; /* Cian brillante */
}

.cat-description-text {
    font-size: 1.1rem;
    color: #e2e8f0; /* Gris muy clarito/blanco */
    line-height: 1.6;
    margin-bottom: 20px;
    font-weight: 500;
}

.cat-description-editor {
    font-size: 0.95rem;
    color: #ffffff;
    font-weight: bold;
    background-color: rgba(0,0,0,0.3); /* Fondo oscuro semitransparente */
    padding: 10px 20px;
    border-radius: 12px;
    border: 2px dashed #22d3ee;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

/* ============================================ */
/* BUSCADOR EXPANDIBLE MODERNO                  */
/* ============================================ */
.search-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 15px;
    position: relative;
    z-index: 5;
}

.input-search {
    display: block;
    color: var(--texto-titulos);
    background: linear-gradient(142.99deg, rgba(255, 255, 255, 0.9) 15.53%, rgba(243, 243, 243, 0.9) 88.19%);
    box-shadow: 0px 12px 24px -1px rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    border-radius: 50px;
    margin: 0 auto;
    padding: 18px 25px;
    outline: none; 
    text-align: center;
    width: 250px; 
    transition: width 0.5s ease;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.input-search::placeholder {
    color: var(--texto-secundario);
    font-weight: 500;
}

.input-search:hover {
    width: 300px; 
}

.input-search:focus {
    width: 380px; 
    outline: none;
    border-color: transparent;
    background: linear-gradient(142.99deg, rgba(255, 255, 255, 0.95) 15.53%, rgba(243, 243, 243, 0.95) 88.19%);
    box-shadow: 0px 12px 24px -1px rgba(0, 0, 0, 0.4);
}

body.dark-mode .input-search {
    background: linear-gradient(142.99deg, rgba(30, 41, 59, 0.9) 15.53%, rgba(15, 23, 42, 0.9) 88.19%);
    box-shadow: 0px 12px 24px -1px rgba(0, 0, 0, 0.5);
    color: var(--blanco);
}

body.dark-mode .input-search:focus {
    background: linear-gradient(142.99deg, rgba(30, 41, 59, 0.9) 15.53%, rgba(15, 23, 42, 0.9) 88.19%);
    border-color: transparent;
    outline: none;
}


/* ============================================ */
/* CUADRÍCULA DE PUBLICACIONES CENTRADA         */
/* ============================================ */
.publicaciones-grid {
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px 60px 20px;
}

.destacados-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; 
    gap: 30px; 
}

/* ============================================ */
/* TARJETAS ESTILO CRISTAL (GLASSMORPHISM)      */
/* ============================================ */
.uiverse-wrapper {
    width: 280px; 
    box-sizing: border-box;
    background: rgba(217, 217, 217, 0.4);
    border: 1px solid white;
    box-shadow: 12px 17px 51px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 17px;
    transition: all 0.4s ease;
    cursor: pointer;
    text-decoration: none; 
    display: flex;
    flex-direction: column; 
    overflow: hidden;
}

.uiverse-wrapper:hover {
    border: 1px solid #94a3b8; 
    transform: scale(1.02) translateY(-5px); 
}

.uiverse-wrapper:active {
    transform: scale(0.98); 
}

body.dark-mode .uiverse-wrapper {
    background: rgba(22, 27, 34, 0.58);
    border: 1px solid #30363d;
    box-shadow: 12px 17px 51px rgba(0, 0, 0, 0.4);
}

body.dark-mode .uiverse-wrapper:hover {
    border: 1px solid var(--color-accion);
}

.uiverse-inner {
    width: 100%; 
    height: 100%; 
    background-color: transparent; 
    display: flex;
    flex-direction: column; 
}

.destacado-imagen { 
    width: 100%; 
    height: 170px; 
    overflow: hidden; 
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

body.dark-mode .destacado-imagen {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.destacado-imagen img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.5s ease;
}

.uiverse-wrapper:hover .destacado-imagen img {
    transform: scale(1.08); 
}

.destacado-contenido { 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
}

.destacado-categoria {
    display: inline-block; 
    background: var(--fondo-etiqueta); 
    color: var(--texto-etiqueta);
    font-size: 0.75rem; 
    padding: 4px 12px; 
    border-radius: 20px; 
    margin-bottom: 12px; 
    font-weight: 700; 
    width: fit-content;
}

.destacado-titulo { 
    font-size: 1.15rem; 
    font-weight: 800; 
    color: var(--texto-titulos); 
    margin-top: 0;
    margin-bottom: 10px; 
    line-height: 1.4; 
}

.destacado-fecha { 
    font-size: 0.8rem; 
    color: var(--texto-secundario); 
    margin-bottom: 12px;
    font-weight: 500;
}

.destacado-resumen { 
    font-size: 0.9rem; 
    color: var(--texto-titulos); 
    line-height: 1.5; 
    max-height: 4.5em; 
    overflow: hidden; 
}

/* --- ESTADO VACÍO --- */
.sin-publicaciones {
    text-align: center;
    padding: 60px;
    background-color: var(--blanco);
    border-radius: 16px;
    border: 1px solid var(--borde-tarjeta);
    transition: background-color 0.3s, border-color 0.3s;
    width: 100%;
}

.sin-publicaciones i {
    font-size: 4rem;
    color: var(--texto-secundario);
    margin-bottom: 20px;
}

.sin-publicaciones h3 {
    margin-top: 20px;
    color: var(--texto-titulos);
}

.sin-publicaciones p {
    color: var(--texto-secundario);
    margin-top: 10px;
    margin-bottom: 25px;
}

.btn-create {
    display: inline-block;
    background-color: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-create:hover {
    background-color: #059669;
}

/* ============================================ */
/* RESPONSIVIDAD                                */
/* ============================================ */
@media (max-width: 768px) {
    .destacados-grid { gap: 20px; }
    
    .uiverse-wrapper { 
        width: 100%; 
        max-width: 350px; 
    }
    
    .titulo-categoria-full h1 { font-size: 2.2rem; }
    
    .input-search {
        width: 100%; 
        max-width: 280px;
    }
    .input-search:hover, .input-search:focus {
        width: 100%;
        max-width: 320px;
    }
}