/* ==========================================================================
   VARIABLES GLOBALES (Modifica aquí para reutilizar en otros artículos)
   ========================================================================== */
:root {
    --primary-color: #0056b3;     /* Color de identidad (ChatsMéxico) */
    --primary-dark: #003d80;      /* Color interactivo hover */
    --accent-color: #e63946;      /* Color de llamadas de atención / alertas */
    --text-main: #212529;         /* Cuerpo de texto principal */
    --text-muted: #6c757d;        /* Metadatos y textos secundarios */
    --bg-main: #f8f9fa;           /* Fondo general de la página */
    --bg-white: #ffffff;          /* Fondo de tarjetas y contenedores */
    --border-color: #dee2e6;      /* Separadores y bordes sutiles */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

/* ==========================================================================
   ESTILOS BASE & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-main);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================================
   HEADER / NAVEGACIÓN (Consistente con ChatsMéxico)
   ========================================================================== */
.site-header {
    background-color: var(--bg-white);
    border-bottom: 3px solid var(--primary-color);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.site-logo span {
    color: var(--accent-color);
}

.site-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

.site-nav a {
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
    text-transform: uppercase;
}

.site-nav a:hover, .site-nav .active {
    color: var(--primary-color);
    text-decoration: none;
}

/* ==========================================================================
   LAYOUT DE DOS COLUMNAS (Principal & Sidebar)
   ========================================================================== */
.main-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

main {
    min-width: 0;
}

@media (max-width: 992px) {
    .main-container {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   TÍTULOS DE SECCIÓN
   ========================================================================== */
.section-title {
    font-size: 24px;
    font-weight: 800;
    color: #111;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   ESTRUCTURA DE FEED DE NOTICIAS (Solución anti-desbordamiento)
   ========================================================================== */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.news-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 0; /* IMPRESCINDIBLE: Previene que la columna grid se expanda */
    align-items: stretch;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.news-image-wrapper {
    position: relative;
    background-color: #eee;
    width: 100%;
    min-height: 200px; /* Asegura altura en escritorio independientemente del texto */
    overflow: hidden;
}

.news-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.news-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Previene desbordamiento por textos largos */
}

@media (max-width: 600px) {
    .news-card {
        grid-template-columns: 1fr;
    }
    .news-image-wrapper {
        height: 200px;
    }
    .news-image-wrapper img {
        position: relative;
    }
}

.news-category {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.news-title {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 800;
    margin-bottom: 10px;
}

.news-title a {
    color: #111;
}

.news-title a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.news-excerpt {
    font-size: 14px;
    color: #495057;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    font-size: 12px;
    color: var(--text-muted);
}


/* ==========================================================================
   DISEÑO DEL ARTÍCULO
   ========================================================================== */
.article-card {
    background-color: var(--bg-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

@media (max-width: 576px) {
    .article-card {
        padding: 20px;
    }
}

.article-category {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: inline-block;
}

.article-title {
    font-size: 32px;
    line-height: 1.25;
    font-weight: 800;
    margin-bottom: 15px;
    color: #111;
}

.article-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 25px;
    line-height: 1.4;
    font-weight: 400;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    margin-bottom: 30px;
    font-size: 13px;
    color: var(--text-muted);
}

.author-name {
    font-weight: 600;
    color: var(--text-main);
}

/* Cuerpo de Texto */
.article-content p {
    font-size: 16px;
    margin-bottom: 20px;
    color: #333;
    text-align: justify;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto; /* Agrega guiones automáticamente al dividir palabras al final de la línea */
}

.article-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 35px 0 15px 0;
    color: #111;
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
}

.article-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 25px 0 12px 0;
    color: #222;
}

.article-content blockquote {
    background-color: var(--bg-main);
    border-left: 4px solid var(--accent-color);
    padding: 15px 20px;
    margin: 25px 0;
    font-style: italic;
    color: #495057;
}

/* Imagen Destacada del Artículo */
.article-featured-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 5px 0 25px 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: block;
}

/* ==========================================================================
   ELEMENTOS EMBEBIDOS (Twitter / X y YouTube)
   ========================================================================== */

/* Contenedor del post embebido de X (Twitter) */
.tweet-embed-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    width: 100%;
}

/* Contenedor de video responsivo (YouTube 16:9) */
.video-embed-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Proporción 16:9 */
    height: 0;
    margin: 30px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background-color: #000;
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==========================================================================
   BLOQUES DE ENLACES INTERNOS (Generadores de Tráfico)
   ========================================================================== */
.internal-link-box {
    background-color: #e9f5ff;
    border: 1px dashed var(--primary-color);
    padding: 15px;
    margin: 25px 0;
    border-radius: 6px;
    text-align: center;
}

.internal-link-box a {
    font-weight: 700;
    font-size: 16px;
}

/* ==========================================================================
   BOTONES DE COMPARTIR EN REDES SOCIALES
   ========================================================================== */
.share-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.share-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #ffffff !important;
    font-size: 16px;
    transition: transform 0.2s ease, filter 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.share-btn:hover {
    transform: translateY(-3px);
    filter: brightness(0.9);
    text-decoration: none;
}

/* Colores oficiales de marca */
.share-btn.btn-x { background-color: #000000; }
.share-btn.btn-facebook { background-color: #1877F2; }
.share-btn.btn-whatsapp { background-color: #25D366; }
.share-btn.btn-linkedin { background-color: #0A66C2; }

/* ==========================================================================
   SIDEBAR & WIDGETS DE PUBLICIDAD
   ========================================================================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.widget {
    background-color: var(--bg-white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
    letter-spacing: 0.5px;
}

/* Banner Publicitario Tipo 1 */
.ad-banner {
    background: linear-gradient(135deg, #0056b3, #003d80);
    color: white;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s;
}

.ad-banner:hover {
    transform: translateY(-2px);
}

.ad-banner h3 {
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 800;
    color: #fff;
}

.ad-banner p {
    font-size: 14px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.ad-button {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background-color 0.2s;
}

.ad-button:hover {
    background-color: #c92a3a;
    color: white;
    text-decoration: none;
}

/* Banner Publicitario Tipo 2 */
.ad-banner-alt {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Listas de Enlaces Complementarias */
.related-posts {
    list-style: none;
}

.related-posts li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.related-posts li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* ==========================================================================
   FOOTER / PIE DE PÁGINA
   ========================================================================== */
.site-footer {
    background-color: #111;
    color: #aaa;
    padding: 40px 20px;
    margin-top: 50px;
    font-size: 14px;
    border-top: 4px solid var(--primary-color);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links a {
    color: #aaa;
    margin-left: 15px;
}

.footer-links a:hover {
    color: #fff;
}

/* ==========================================================================
   TABLAS RESPONSIVAS (Para Escritorio y Móvil)
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 25px 0;
    box-shadow: var(--shadow-sm);
    border-radius: 6px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    border: 1px solid var(--border-color);
    margin: 0; 
    box-shadow: none;
}

.stats-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    font-weight: 700;
    text-align: left;
}

.stats-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: #333;
}

.stats-table tr:nth-child(even) {
    background-color: var(--bg-main);
}

/* Estilos complementarios específicos para el lector de feeds JSON */
.source-badge {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-right: 8px;
}
.read-more-link {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    margin-top: 10px;
    color: var(--primary-color);
}
.copyright-disclaimer {
    background-color: #f1f3f5;
    border-left: 4px solid var(--text-muted);
    padding: 15px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 30px;
    border-radius: 4px;
}
