:root {
    --primary-orange: #FF6600;
    --primary-dark: #E65C00;
    --bg-color: #F8F9FA;
    --text-main: #1A1A1A;
    --text-muted: #555555;
    --white: #FFFFFF;
    --border-color: #E2E8F0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- ENCABEZADO Y NAVEGACIÓN --- */
header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.main-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 65px;
    width: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.search-box input {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    width: 240px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary-orange);
}

nav {
    background-color: var(--text-main);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    list-style: none;
    overflow-x: auto;
}

.nav-container li a {
    display: block;
    padding: 14px 20px;
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.3s;
}

.nav-container li a:hover, .nav-container li.active a {
    background-color: var(--primary-orange);
}

/* --- CONTENEDORES Y TARJETAS --- */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 40px;
}

.main-news, .sidebar-section, .search-result-card, .news-card, .article-card, .sin-resultados, .not-found {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.main-news, .article-card {
    overflow: hidden; /* Garantiza que cualquier elemento interno respete los bordes redondeados de la tarjeta */
}

/* --- FORMATO FIJO Y RESPONSIVO CON BORDES REDONDEADOS PARA IMÁGENES DE TÍTULO --- */
.main-news img, .article-image {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 420px;
    object-fit: contain;
    background-color: #FFFFFF;
    display: block;
    margin: 0 auto;
    border-radius: 8px !important; /* Bordes redondeados forzados para PC y móvil */
}

/* --- CORRECCIÓN DEFINITIVA PARA IMÁGENES COPIADAS DE REDES SOCIALES O EXTERNAS --- */
.article-body img, 
.news-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: fill !important;
    display: block !important;
    margin: 20px auto !important;
    float: none !important;
    clear: both !important;
    border-radius: 6px;
}

.news-content {
    padding: 25px;
}

.category-tag {
    display: inline-block;
    background-color: var(--primary-orange);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.main-news h1, .search-result-card h3 a, .news-card h3 a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.main-news h1 a:hover, .search-result-card h3 a:hover, .news-card h3 a:hover {
    color: var(--primary-orange);
}

.main-news p, .main-news div, .search-result-card p, .news-card p, .news-card div {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 8px;
}

/* --- CONTENIDO DEL ARTÍCULO Y ESPACIADO PERFECTO --- */
.article-body {
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.6;
    text-align: left !important;
    clear: both !important;
}

/* Control estricto de bloques, párrafos y neutralización de flotados para igualar categorías */
.article-body p, 
.article-body div, 
.article-body span {
    margin-bottom: 8px;
    margin-top: 0;
    text-align: left !important;
    float: none !important;
    clear: both !important;
    display: block !important;
    width: 100% !important;
}

.article-body p:last-child {
    margin-bottom: 0;
}

.article-body embed, 
.article-body object {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 6px;
}

/* Ajuste general para iframes */
.article-body iframe {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 480px;
    display: block;
    margin: 20px auto;
    border-radius: 6px;
}

/* --- BARRA LATERAL --- */
.sidebar-section {
    padding: 20px;
}

.sidebar-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-orange);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.mini-news-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.mini-news-item:last-child {
    border-bottom: none;
}

.mini-news-item span.time {
    font-size: 0.75rem;
    color: var(--primary-orange);
    font-weight: 600;
}

.mini-news-item h4 {
    font-size: 0.95rem;
    margin-top: 4px;
}

.mini-news-item h4 a {
    color: var(--text-main);
    text-decoration: none;
}

.mini-news-item h4 a:hover {
    color: var(--primary-orange);
}

.sin-noticias, .sin-resultados, .not-found {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- PAGINACIÓN --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-main);
    transition: all 0.2s;
}

.pagination a:hover, .pagination .active {
    background-color: var(--primary-orange);
    color: var(--white);
    border-color: var(--primary-orange);
}

.pagination .disabled {
    color: #A0AEC0;
    background-color: #EDF2F7;
    pointer-events: none;
}

/* --- PIE DE PÁGINA --- */
footer {
    background-color: var(--text-main);
    color: var(--white);
    padding: 20px 20px;
    text-align: center;
    margin-top: 30px;
    font-size: 0.9rem;
}

footer p {
    color: #A0AEC0;
}

/* --- GALERÍA DE IMÁGENES EN EL CUERPO --- */
.news-gallery-single {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 30px 0;
}

.news-gallery-single a {
    display: block;
    width: 100%;
    text-align: center;
    background-color: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-gallery-single a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.news-gallery-single img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* --- ADAPTABILIDAD ESCRITORIO (PC) PARA VIDEOS VERTICALES --- */
@media (min-width: 769px) {
    .article-body iframe,
    .article-body embed,
    .article-body object {
        max-width: 420px !important;
        width: 100% !important;
        height: 780px !important;
        margin: 20px auto !important;
        display: block !important;
    }
}

/* --- ADAPTABILIDAD MÓVIL --- */
@media (max-width: 768px) {
    .container {
        margin: 15px auto;
        padding: 0 12px;
    }

    .top-bar {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .main-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 10px;
        text-align: center;
    }

    .search-box input {
        width: 100%;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .admin-card, .article-card {
        padding: 20px 15px !important;
    }

    .article-title, .main-news h1 {
        font-size: 1.6rem !important;
        line-height: 1.3;
    }

    /* Ajuste responsivo fluido para imágenes de URL directa en celulares */
    .main-news img, .article-image {
        width: 100% !important;
        height: auto !important;       
        max-height: 250px !important;
        object-fit: contain !important;
        border-radius: 8px !important;
    }

    .news-gallery-single img {
        max-height: 400px !important;
    }

    .article-body iframe,
    .article-body embed,
    .article-body object {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 420px !important;
        height: auto !important;
    }

    .nav-container {
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .nav-container li a {
        padding: 12px 15px;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .admin-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
}