/* ============================================
   Estilos para Página de Noticias
   ============================================ */

/* === Hero News Section === */
.hero-news {
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    color: var(--text-light);
    padding: 3rem 0;
    text-align: center;
}

.hero-news h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-news p {
    font-size: 1.125rem;
    color: #b0b0b0;
    max-width: 800px;
    margin: 0 auto;
}

/* === News Content Layout === */
.news-content {
    padding: 3rem 0;
    background: #f8f9fa;
}

.news-content .container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

/* === News Filters === */
.news-filters {
    grid-column: 1 / -1;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.news-filters h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: #f0f0f0;
    color: var(--text-primary);
    border: 2px solid transparent;
    padding: 0.625rem 1.25rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.875rem;
}

.filter-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* === Loading Spinner === */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* === Error Message === */
.error-message {
    grid-column: 1 / -1;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.error-message h3 {
    color: #856404;
    margin-bottom: 0.5rem;
}

.error-message p {
    color: #856404;
}

/* === News Grid === */
.news-grid {
    /* CRÍTICO: Especificar que debe estar en la PRIMERA columna del grid */
    grid-column: 1;
    
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* === Date Group Headers === */
.news-date-group {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.date-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-color);
    font-weight: 700;
}

.date-icon {
    font-size: 1.75rem;
}

.date-count {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.news-group-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* === News Card === */
.news-card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Card Header */
.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.news-source {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Estilo sobrio para nombre de fuente (SIN background) */
.news-source-text {
    display: inline-block;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Estilo sobrio para fecha (SIN icono) */
.news-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* CIA+NR Tags */
.cia-tags-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cia-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cia-confidentiality {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.cia-integrity {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.cia-availability {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%);
}

.cia-non-repudiation {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

/* Card Image */
.news-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f0f0f0;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.news-card:hover .news-image img {
    transform: scale(1.05);
}

/* Card Body */
.news-card-body {
    padding: 1.5rem;
    flex-grow: 1;
}

.news-card-body h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.news-card-body h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.news-card-body h3 a:hover {
    color: var(--primary-color);
}

.news-card-body p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9375rem;
}

/* Card Footer */
.news-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.read-more-btn:hover {
    color: var(--secondary-color);
    gap: 0.5rem;
}

/* === News Sidebar === */
.news-sidebar {
    /* CRÍTICO: Especificar que debe estar en la SEGUNDA columna del grid */
    grid-column: 2;
    
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-widget {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.sidebar-widget h3 {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Source Info */
.source-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.source-info:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.source-info h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.source-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Popular Tags */
.popular-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.popular-tags li a {
    display: inline-block;
    background: #f0f0f0;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.popular-tags li a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Source List */
.source-list {
    list-style: none;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 2;
}

.source-list li {
    padding-left: 0.5rem;
    transition: var(--transition);
}

.source-list li:hover {
    color: var(--primary-color);
    padding-left: 1rem;
}

/* CIA Legend in Sidebar */
.cia-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cia-legend li {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cia-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-left: 0.25rem;
}

/* === No Results === */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* === Responsive Design === */
@media (max-width: 968px) {
    .news-content .container {
        grid-template-columns: 1fr;
    }
    
    /* En móvil, ambos elementos ocupan toda la columna */
    .news-grid {
        grid-column: 1;
    }
    
    .news-sidebar {
        grid-column: 1;
        order: -1;
    }
    
    .hero-news h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .hero-news h1 {
        font-size: 1.75rem;
    }
    
    .hero-news p {
        font-size: 1rem;
    }
    
    .filter-buttons {
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    .news-image {
        height: 200px;
    }
    
    .news-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    .cia-tags-container {
        width: 100%;
    }
    
    .date-group-header {
        font-size: 1.25rem;
    }
}

/* === Dark Mode Support === */
@media (prefers-color-scheme: dark) {
    .news-filters,
    .news-card,
    .sidebar-widget {
        background: #2a2a2a;
        color: var(--text-light);
    }
    
    .news-card-header {
        background: #1a1a1a;
    }
    
    .news-card-body h3 a {
        color: var(--text-light);
    }
    
    .filter-btn {
        background: #3a3a3a;
        color: var(--text-light);
    }
    
    .popular-tags li a {
        background: #3a3a3a;
        color: var(--text-light);
    }
    
    .date-group-header {
        color: var(--text-light);
        border-bottom-color: var(--secondary-color);
    }
    
    .cia-desc {
        color: #b0b0b0;
    }
}

/* === Print Styles === */
@media print {
    .main-header,
    .hero-news,
    .news-filters,
    .news-sidebar,
    .main-footer,
    .news-card-footer {
        display: none;
    }
    
    .news-content .container {
        grid-template-columns: 1fr;
    }
    
    .news-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
}
/* ============================================
   ESTILOS PARA BARRA DE PROGRESO OPTIMIZADA
   Agregar al final de news.css
   ============================================ */

/* === Progress Bar Container === */
.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem auto;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* === Progress Bar Fill === */
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0066cc 0%, #00a86b 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 102, 204, 0.5);
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* === Progress Text === */
.progress-text {
    color: #666;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
    text-align: center;
}

/* === Loading Container Improvements === */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 300px;
}

.loading .spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading > p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* === Cache Info Badge (opcional) === */
.cache-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    z-index: 1000;
    animation: slideInUp 0.5s ease-out;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cache-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Responsive === */
@media (max-width: 768px) {
    .progress-bar-container {
        max-width: 280px;
    }
    
    .loading {
        padding: 2rem 1rem;
        min-height: 250px;
    }
    
    .loading .spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .loading > p {
        font-size: 1rem;
    }
    
    .progress-text {
        font-size: 0.8rem;
    }
    
    .cache-badge {
        bottom: 10px;
        right: 10px;
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
    }
}

/* === Dark Mode Support === */
@media (prefers-color-scheme: dark) {
    .progress-bar-container {
        background: #2a2a2a;
    }
    
    .progress-text {
        color: #b0b0b0;
    }
    
    .loading > p {
        color: #b0b0b0;
    }
}