:root {
    --bg-main: #f4f6f9;
    --bg-card: #ffffff;
    --text-primary: #0f1c2e;
    --text-secondary: #555555;
    --accent-color: #e31b23;
    --border-color: #e1e4e8;
    --header-bg: #0f1c2e;
    --subnav-bg: #e9ecef;
    --nav-bg: #0f1c2e;
    --nav-text: #ffffff;
    --tw-btn-bg: #0f1419;
}

[data-theme="dark"] {
    --bg-main: #0b131e;
    --bg-card: #152233;
    --text-primary: #f0f4f8;
    --text-secondary: #a0aec0;
    --border-color: #23354d;
    --header-bg: #080f18;
    --subnav-bg: #1a293d;
    --nav-bg: #152233;
    --nav-text: #ffffff;
    --tw-btn-bg: #2d3748;
}

/* Control Interno de Visibilidad Exclusivo para la Cabecera */
header .logo-dark { display: none !important; }
header .logo-light { display: block !important; }

[data-theme="dark"] header .logo-dark { display: block !important; }
[data-theme="dark"] header .logo-light { display: none !important; }

/* Reset Global & Estructura Definitiva para Sticky Footer */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    height: 100%;
}

body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
    background-color: var(--bg-main); 
    color: var(--text-primary); 
    transition: background 0.3s, color 0.3s; 
    line-height: 1.5; 
    overflow-x: hidden; 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-color); }

/* Topbar */
.top-bar { background: var(--header-bg); color: #fff; padding: 0.4rem 1rem; font-size: 0.8rem; border-bottom: 1px solid var(--border-color); }
.top-bar-container { max-width: 1380px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.top-bar-left { display: flex; gap: 1.5rem; }
.ticker-label { color: #4cd964; font-weight: bold; }
.top-bar-right { display: flex; gap: 1rem; align-items: center; }
.theme-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 0.38rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: bold; display: inline-flex; align-items: center; gap: 0.4rem; transition: all 0.2s; }
.theme-btn:hover { background: var(--accent-color); border-color: var(--accent-color); }

/* Header & Logo */
header { background: var(--bg-card); padding: 1.2rem 0; border-bottom: 1px solid var(--border-color); transition: background 0.3s; }
.header-container { max-width: 1380px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; }
.logo-img { height: 65px; object-fit: contain; }
.header-banner { background: #f0f0f0; color: #888; width: 728px; height: 90px; display: flex; align-items: center; justify-content: center; border: 1px dashed #ccc; font-size: 0.85rem; font-weight: bold; text-align: center; }

/* Menú Principal */
nav { background: var(--nav-bg); color: var(--nav-text); position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.15); border-bottom: 2px solid var(--accent-color); }
.nav-container { max-width: 1380px; margin: 0 auto; display: flex; gap: 0.5rem; overflow-x: auto; padding: 0 1rem; -webkit-overflow-scrolling: touch; }
nav a { padding: 0.9rem 0.8rem; font-weight: 700; font-size: 0.88rem; white-space: nowrap; border-bottom: 3px solid transparent; text-transform: uppercase; color: #ffffff !important; }
nav a:hover, nav a.active { border-bottom-color: var(--accent-color); background: rgba(255,255,255,0.1); }

/* Subnav Tendencias */
.subnav-trending { background: var(--subnav-bg); padding: 0.5rem 1rem; font-size: 0.8rem; border-bottom: 1px solid var(--border-color); }
.subnav-container { max-width: 1380px; margin: 0 auto; display: flex; gap: 1rem; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.trend-tag { color: var(--accent-color); font-weight: bold; white-space: nowrap; }
.subnav-container a { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }

/* Contenedor Principal Adaptable */
.container { 
    max-width: 1380px; 
    margin: 2rem auto; 
    padding: 0 1rem; 
    flex: 1 0 auto;
    width: 100%;
}

/* Hero Section */
.hero-grid { display: grid; grid-template-columns: 2.8fr 1.2fr; gap: 2rem; margin-bottom: 3rem; }
.main-article { background: var(--bg-card); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.img-wrapper { position: relative; margin-bottom: 1.2rem; }
.img-wrapper img { width: 100%; height: 420px; object-fit: cover; border-radius: 6px; }
.badge-cat { position: absolute; bottom: 12px; left: 12px; background: var(--accent-color); color: #fff; padding: 0.4rem 0.8rem; font-size: 0.75rem; font-weight: 800; border-radius: 3px; }
.main-article h1 { font-size: 2rem; margin-bottom: 1rem; line-height: 1.25; color: var(--text-primary); }
.main-article p { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 1.2rem; }

/* Compartir */
.share-inline { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; font-weight: bold; border-top: 1px solid var(--border-color); padding-top: 0.8rem; margin-top: 0.5rem; line-height: 1; color: var(--text-primary); }
.share-btn { width: 36px; height: 36px; border-radius: 50%; color: #ffffff !important; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 0.95rem; transition: transform 0.2s; }
.share-btn:hover { transform: scale(1.1); }
.share-btn.fb { background: #1877f2; }
.share-btn.tw { background: #0f1419; border: 1px solid rgba(255,255,255,0.3); }
.share-btn.wa { background: #25d366; }

/* Sidebar */
.sidebar-latest { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-widget { background: var(--bg-card); padding: 1.2rem; border-radius: 8px; border: 1px solid var(--border-color); }
.widget-title { font-size: 1.1rem; color: var(--accent-color); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--accent-color); display: flex; align-items: center; gap: 0.5rem; }
.latest-item { margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-color); }
.latest-item:last-child { border-bottom: none; }
.cat-tag { font-size: 0.7rem; color: var(--accent-color); font-weight: 800; text-transform: uppercase; }
.latest-item h4 { font-size: 0.95rem; margin: 0.3rem 0; line-height: 1.35; color: var(--text-primary); }
.time-ago { font-size: 0.75rem; color: var(--text-secondary); }
.sidebar-ad-box { background: var(--subnav-bg); border: 1px dashed var(--border-color); height: 250px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 0.85rem; border-radius: 8px; font-weight: bold; text-align: center; padding: 0.5rem; }

/* Secciones Generales */
.section-block { margin-bottom: 3.5rem; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid var(--text-primary); padding-bottom: 0.6rem; margin-bottom: 1.5rem; height: 45px; }
.section-header h2 { font-size: 1.4rem; display: flex; align-items: center; gap: 0.5rem; margin: 0; line-height: 1; color: var(--text-primary); }
.see-more { font-size: 0.85rem; font-weight: bold; color: var(--accent-color); display: inline-flex; align-items: center; gap: 0.3rem; line-height: 1; white-space: nowrap; }

/* Grillas */
.grid-3-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.news-card { background: var(--bg-card); padding: 1.2rem; border-radius: 8px; border: 1px solid var(--border-color); transition: transform 0.2s, box-shadow 0.2s; }
.news-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.news-card img { width: 100%; height: 200px; object-fit: cover; border-radius: 6px; margin-bottom: 0.8rem; }
.news-card h4 { font-size: 1.1rem; margin: 0.5rem 0; line-height: 1.3; color: var(--text-primary); }
.news-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.4; }

/* Híbrido Economía */
.hybrid-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.featured-medium { background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border-color); overflow: hidden; display: flex; flex-direction: column; }
.featured-medium img { width: 100%; height: 320px; object-fit: cover; }
.featured-content { padding: 1.2rem; }
.featured-content h3 { font-size: 1.4rem; margin: 0.5rem 0; color: var(--text-primary); }
.vertical-list { background: var(--bg-card); padding: 1.2rem; border-radius: 8px; border: 1px solid var(--border-color); display: flex; flex-direction: column; justify-content: space-between; }
.list-item { padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-color); }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item h4 { font-size: 0.95rem; margin-top: 0.2rem; color: var(--text-primary); }

/* Feed Continuo */
.feed-layout { display: grid; grid-template-columns: 2.8fr 1.2fr; gap: 2rem; }
.feed-list { display: flex; flex-direction: column; gap: 1.5rem; }
.feed-item { background: var(--bg-card); padding: 1.2rem; border-radius: 8px; border: 1px solid var(--border-color); display: flex; gap: 1.2rem; align-items: center; transition: transform 0.2s; }
.feed-item:hover { transform: translateX(4px); }
.feed-item img { width: 220px; height: 140px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.feed-content h3 { font-size: 1.2rem; margin: 0.4rem 0; line-height: 1.3; color: var(--text-primary); }
.feed-content p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.6rem; }

/* Botón Cargar Más y Botones Generales */
.load-more-btn { background: var(--header-bg); color: #fff; border: none; padding: 0.9rem 1.5rem; font-weight: bold; border-radius: 6px; cursor: pointer; width: 100%; margin-top: 1.5rem; text-transform: uppercase; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: background 0.2s, color 0.2s; }
.load-more-btn:hover { background: var(--accent-color); color: #ffffff !important; }

/* Sidebar Feed */
.feed-sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.trending-rank-item { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-color); }
.trending-rank-item:last-child { border-bottom: none; }
.rank-number { font-size: 1.8rem; font-weight: 900; color: var(--accent-color); width: 30px; text-align: center; }
.trending-rank-item h4 { font-size: 0.9rem; line-height: 1.3; color: var(--text-primary); }

/* Opinión */
.opinion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.opinion-card { background: var(--bg-card); padding: 1.2rem; border-radius: 8px; border: 1px solid var(--border-color); display: flex; gap: 1rem; align-items: center; }
.author-avatar img { width: 65px; height: 65px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-color); flex-shrink: 0; }
.author-name { font-size: 0.8rem; color: var(--accent-color); font-weight: bold; text-transform: uppercase; }
.opinion-info h4 { font-size: 0.95rem; margin-top: 0.3rem; line-height: 1.3; color: var(--text-primary); }

/* Footer Definitivo Fijo al Borde Inferior */
footer { 
    background: var(--header-bg); 
    color: #fff; 
    padding-top: 3rem; 
    margin-top: auto; 
    border-top: 4px solid var(--accent-color); 
    width: 100%;
    flex-shrink: 0;
}
.footer-container { max-width: 1380px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem; padding: 0 1rem 3rem 1rem; }
.footer-logo { height: 55px; margin-bottom: 1rem; object-fit: contain; }
.brand-col p { font-size: 0.88rem; color: #a0aec0; line-height: 1.6; margin-bottom: 1.5rem; }
.footer-newsletter h5 { font-size: 0.9rem; margin-bottom: 0.6rem; text-transform: uppercase; color: #fff; }
.newsletter-form { display: flex; gap: 0.5rem; }
.newsletter-form input { flex: 1; padding: 0.6rem; border-radius: 4px; border: 1px solid #334155; background: #1e293b; color: #fff; outline: none; }
.newsletter-form button { background: var(--accent-color); color: #fff; border: none; padding: 0 1rem; border-radius: 4px; cursor: pointer; }
.footer-col h4 { font-size: 1rem; margin-bottom: 1.2rem; color: #fff; border-bottom: 2px solid var(--accent-color); display: inline-block; padding-bottom: 0.3rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.6rem; font-size: 0.88rem; }
.footer-col a { color: #cbd5e0; }
.footer-col a:hover { color: #fff; padding-left: 3px; }
.footer-bottom { background: rgba(0,0,0,0.3); padding: 1.2rem 1rem; font-size: 0.85rem; color: #94a3b8; border-top: 1px solid rgba(255,255,255,0.05); }
.footer-bottom-container { max-width: 1380px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer-socials-bottom { display: flex; gap: 1rem; }

/* Adaptabilidad Responsiva */
@media (max-width: 1024px) {
    .header-banner { width: 468px; }
    .hero-grid, .feed-layout { grid-template-columns: 1fr; }
    .grid-3-col, .opinion-grid { grid-template-columns: repeat(2, 1fr); }
    .hybrid-grid { grid-template-columns: 1fr; }
    .footer-container { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

@media (max-width: 768px) {
    .top-bar-left span:not(:first-child) { display: none; }
    .header-container { flex-direction: column; gap: 1rem; text-align: center; }
    .header-banner { display: none; }
    .logo-img { height: 50px; }
    .img-wrapper img { height: 280px; }
    .main-article h1 { font-size: 1.5rem; }
    .feed-item { flex-direction: column; align-items: flex-start; }
    .feed-item img { width: 100%; height: 200px; }
    .footer-container { grid-template-columns: 1fr; }
    .footer-bottom-container { flex-direction: column; gap: 1rem; text-align: center; }
}

@media (max-width: 480px) {
    .container { margin: 1rem auto; padding: 0 0.8rem; }
    .grid-3-col, .opinion-grid { grid-template-columns: 1fr; }
    .section-header { flex-direction: row; align-items: center; justify-content: space-between; }
    .section-header h2 { font-size: 1.1rem; }
    .see-more { font-size: 0.75rem; }
    .main-article { padding: 1rem; }
    .main-article h1 { font-size: 1.3rem; }
    .main-article p { font-size: 0.95rem; }
    .newsletter-form { flex-direction: column; }
    .newsletter-form button { padding: 0.6rem; }
}

/* Estructura Estándar e Idéntica para Páginas Institucionales */
.page-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 1rem;
    min-height: calc(100vh - 400px);
    box-sizing: border-box;
}

.page-card {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem;
    box-sizing: border-box;
}