/**
 * ============================================
 * NOTICIAS CSS - Diseño Profesional
 * Escuela de Posgrado UNAC
 * ============================================
 */

/* ===================================
   VARIABLES Y COLORES INSTITUCIONALES
   =================================== */
:root {
    /* Colores Principales */
    --primary-blue: #0a2e52;
    --secondary-blue: #1a3a5f;
    --accent-gold: #FFC107;
    --light-gold: #FFD54F;
    
    /* Colores de Texto */
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --text-muted: #8e99a4;
    
    /* Fondos */
    --white: #ffffff;
    --light-bg: #f8f9fa;
    --border-light: #e9ecef;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 4px 20px rgba(10, 46, 82, 0.08);
    --shadow-card-hover: 0 12px 40px rgba(10, 46, 82, 0.15);
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition: 0.3s ease;
    --transition-slow: 0.4s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* ===================================
   RESET Y BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--light-bg);
}

.main-content {
    padding-top: 90px;
    min-height: 100vh;
}

/* ===================================
   ANIMACIONES
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===================================
   HERO SECTION
   =================================== */
.noticias-hero {
    position: relative;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    padding: 4rem 0 3.5rem;
    overflow: hidden;
}

.noticias-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 193, 7, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 12s ease-in-out infinite;
}

.noticias-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 213, 79, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 15s ease-in-out infinite reverse;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.85);
    max-width: 500px;
    margin: 0 auto;
    font-weight: 400;
}

/* ===================================
   FILTROS
   =================================== */
.filtros-section {
    background: var(--white);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 90px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.filtros-wrapper {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filtro-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--white);
    border: 2px solid var(--border-light);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all var(--transition);
}

.filtro-btn i {
    font-size: 0.95rem;
    transition: transform var(--transition);
}

.filtro-btn:hover {
    border-color: var(--accent-gold);
    color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.filtro-btn:hover i {
    transform: scale(1.1);
}

.filtro-btn.active {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    border-color: transparent;
    color: var(--white);
    box-shadow: var(--shadow-md);
}

/* ===================================
   CONTENIDO PRINCIPAL
   =================================== */
.noticias-content-section {
    padding: 2.5rem 0 4rem;
    background: var(--light-bg);
}

/* ===================================
   GRID DE NOTICIAS
   =================================== */
.noticias-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* ===================================
   TARJETA DE NOTICIA - PROFESIONAL
   =================================== */
.noticia-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.noticia-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card-hover);
}

.noticia-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    height: 100%;
}

/* Contenedor de imagen */
.noticia-imagen-container {
    position: relative;
    width: 280px;
    min-width: 280px;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.noticia-imagen {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.noticia-imagen.fallback {
    object-fit: contain;
    padding: 2rem;
    background: var(--light-bg);
}

.noticia-imagen-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(10, 46, 82, 0.1) 100%
    );
    opacity: 0;
    transition: opacity var(--transition);
}

.noticia-card:hover .noticia-imagen {
    transform: scale(1.08);
}

.noticia-card:hover .noticia-imagen-overlay {
    opacity: 1;
}

/* Badge de categoría */
.noticia-categoria {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Colores por categoría */
.cat-maestrias {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.cat-doctorados {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

.cat-eventos {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.cat-comunicados {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.cat-general {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
}

/* Cuerpo de la tarjeta */
.noticia-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.noticia-titulo {
    font-family: 'Poppins', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    transition: color var(--transition);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.noticia-card:hover .noticia-titulo {
    color: var(--accent-gold);
}

.noticia-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.meta-fecha {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.meta-fecha i {
    color: var(--accent-gold);
    font-size: 0.9rem;
}

.noticia-leer-mas {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition);
}

.noticia-leer-mas i {
    font-size: 0.8rem;
    transition: transform var(--transition);
}

.noticia-card:hover .noticia-leer-mas {
    color: var(--accent-gold);
}

.noticia-card:hover .noticia-leer-mas i {
    transform: translateX(4px);
}

/* ===================================
   SIDEBAR
   =================================== */
.sidebar-sticky {
    position: sticky;
    top: 160px;
}

.sidebar-widget {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light-bg);
}

.widget-title i {
    color: var(--accent-gold);
    font-size: 1rem;
}

/* Sidebar News Items */
.sidebar-news-item {
    display: flex;
    gap: 0.875rem;
    padding: 0.875rem 0;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
    border-bottom: 1px solid var(--border-light);
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.sidebar-news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-news-item:first-child {
    padding-top: 0;
}

.sidebar-news-item:hover {
    padding-left: 0.5rem;
}

.sidebar-news-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.sidebar-news-item:hover .sidebar-news-thumb img {
    transform: scale(1.1);
}

.sidebar-news-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-news-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    line-height: 1.35;
    transition: color var(--transition);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-news-item:hover .sidebar-news-title {
    color: var(--accent-gold);
}

.sidebar-news-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Sidebar CTA */
.sidebar-cta {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--white);
    text-align: center;
    border-radius: var(--radius-md);
}

.cta-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 193, 7, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.cta-icon i {
    font-size: 1.5rem;
    color: var(--accent-gold);
}

.cta-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.cta-text {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

.btn-sidebar-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: var(--accent-gold);
    color: var(--primary-blue);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.btn-sidebar-cta:hover {
    background: var(--light-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

/* Categorías List */
.categorias-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.categoria-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.875rem;
    background: var(--light-bg);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.categoria-item:hover {
    background: var(--primary-blue);
    color: var(--white);
    padding-left: 1rem;
}

.categoria-count {
    background: var(--accent-gold);
    color: var(--primary-blue);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}

/* ===================================
   ESTADOS DE CARGA Y MENSAJES
   =================================== */
.loading-spinner {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.message-container {
    text-align: center;
    padding: 3rem 2rem;
}

.message-container i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.message-container p {
    color: var(--text-light);
    font-size: 1rem;
}

.sidebar-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem 0;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 991px) {
    .sidebar-sticky {
        position: static;
        margin-top: 2.5rem;
    }
    
    .filtros-section {
        position: static;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding-top: 70px;
    }
    
    .noticias-hero {
        padding: 3rem 0 2.5rem;
    }
    
    .filtros-wrapper {
        gap: 0.5rem;
        padding: 0 0.5rem;
    }
    
    .filtro-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .noticias-content-section {
        padding: 2rem 0 3rem;
    }
    
    /* Cards verticales en móvil */
    .noticia-card-link {
        flex-direction: column;
    }
    
    .noticia-imagen-container {
        width: 100%;
        min-width: 100%;
        height: 180px;
    }
    
    .noticia-body {
        padding: 1.25rem;
    }
    
    .noticia-titulo {
        font-size: 1.05rem;
    }
}

@media (max-width: 576px) {
    .noticias-hero {
        padding: 2.5rem 0 2rem;
    }
    
    .filtros-section {
        padding: 1rem 0;
    }
    
    .filtros-wrapper {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .filtros-wrapper::-webkit-scrollbar {
        display: none;
    }
    
    .filtro-btn {
        flex-shrink: 0;
    }
    
    .noticias-grid {
        gap: 1rem;
    }
    
    .noticia-imagen-container {
        height: 160px;
    }
    
    .noticia-body {
        padding: 1rem;
    }
    
    .noticia-titulo {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .noticia-meta {
        margin-bottom: 0.75rem;
    }
    
    .sidebar-widget {
        padding: 1.25rem;
    }
    
    .sidebar-news-thumb {
        width: 50px;
        height: 50px;
    }
}
