/* =========================================
   TUSINITUSINELI - FINAL PERFECT VERSION
   ========================================= */

:root {
    --bg-body: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-card: #ffffff;
    --bg-sidebar: #f8f9fa;
    --bg-footer: #111111;
    --text-main: #1a1a1a;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --primary: #e60023;
    --primary-hover: #ad001b;
    --accent: #007bff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --header-h: 70px;
    --max-w: 1280px;
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-header: rgba(15, 23, 42, 0.95);
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-footer: #020617;
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #f43f5e;
    --primary-hover: #fb7185;
    --border: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    line-height: 1.7;
    padding-top: var(--header-h);
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden; /* Evita desplazamiento horizontal */
}

a { text-decoration: none; color: inherit; transition: all 0.2s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
iframe { border: none; width: 100%; height: 100%; }

/* --- HEADER --- */
.site-header {
    position: fixed; top: 0; left: 0; width: 100%;
    height: var(--header-h);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex; justify-content: space-between; align-items: center;
}

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

.nav-desktop { display: flex; align-items: center; gap: 30px; }
.nav-link { font-weight: 600; font-size: 15px; color: var(--text-secondary); position: relative; }
.nav-link:hover, .nav-link.active { color: var(--primary); }

.theme-btn {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-main); padding: 8px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; transition: 0.3s;
}
.theme-btn:hover { background: var(--bg-sidebar); border-color: var(--primary); }
.theme-btn svg { width: 20px; height: 20px; fill: currentColor; }

.mobile-toggle { display: none; flex-direction: column; gap: 6px; cursor: pointer; }
.mobile-toggle span { width: 25px; height: 3px; background: var(--text-main); border-radius: 2px; transition: 0.3s; }
.mobile-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.mobile-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

.mobile-overlay {
    position: fixed; top: var(--header-h); left: 0; width: 100%; height: 100vh;
    background: rgba(0,0,0,0.5); z-index: 999;
    opacity: 0; visibility: hidden; transition: 0.3s;
    backdrop-filter: blur(5px);
}
.mobile-nav {
    background: var(--bg-card); width: 80%; max-width: 300px; height: 100%;
    padding: 20px; transform: translateX(-100%); transition: 0.3s;
    display: flex; flex-direction: column; gap: 15px;
    border-right: 1px solid var(--border);
}
.mobile-overlay.open { opacity: 1; visibility: visible; }
.mobile-overlay.open .mobile-nav { transform: translateX(0); }
.mobile-nav a { font-size: 18px; font-weight: 700; padding: 10px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.theme-btn-mobile { margin-top: 20px; padding: 12px; background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--text-main); }

/* --- LAYOUT PRINCIPAL --- */
.layout-container {
    max-width: var(--max-w);
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 50px;
    min-height: 80vh;
    /* Corrección de alineación */
    width: 100%; 
    justify-content: center;
}

/* --- COMPONENTES --- */
.section-header { margin-bottom: 30px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.section-header h1, .section-header h2 { font-size: 28px; font-weight: 800; color: var(--text-main); }
.section-header .subtitle { color: var(--text-muted); font-size: 14px; margin-top: 5px; }
.dot { color: var(--primary); }

.cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px;
}

.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); border-color: var(--primary); }

.card-media { position: relative; padding-top: 56.25%; overflow: hidden; display: block; background: #000; }
.card-media img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.card:hover .card-media img { transform: scale(1.1); }

.badge {
    position: absolute; top: 10px; right: 10px;
    background: var(--primary); color: #fff;
    font-size: 10px; font-weight: 800; padding: 4px 10px;
    border-radius: 4px; text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); z-index: 2;
}
.badge.blue { background: var(--accent); }

.card-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.card-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; flex-grow: 1; }

.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: 700; text-align: center; font-size: 14px; transition: 0.2s; }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); width: 100%; }
.btn-outline:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- ARTÍCULO --- */
.full-article { background: transparent; width: 100%; }
.article-header { margin-bottom: 30px; text-align: center; }
.category-pill { display: inline-block; background: rgba(230, 0, 35, 0.1); color: var(--primary); padding: 5px 15px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-bottom: 15px; }
.category-pill.blue { background: rgba(0, 123, 255, 0.1); color: var(--accent); }
.article-title { font-size: 2.5rem; line-height: 1.2; margin-bottom: 15px; color: var(--text-main); }
.article-meta { color: var(--text-muted); font-size: 14px; display: flex; justify-content: center; gap: 20px; }

.hero-video-container, .hero-image-container {
    width: 100%; border-radius: var(--radius); overflow: hidden;
    margin-bottom: 40px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative; background: #000;
}
.hero-video-container { padding-bottom: 56.25%; height: 0; }
.hero-video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.article-body { font-size: 1.15rem; color: var(--text-secondary); line-height: 1.8; }
.article-body p { margin-bottom: 25px; }
.article-figure { margin: 40px 0; }
.article-figure img { border-radius: var(--radius); width: 100%; box-shadow: var(--shadow); }

/* --- CONTENEDOR DE ANUNCIOS CENTRADO (LA SOLUCIÓN) --- */
.ad-container-wrapper {
    width: 100%;
    margin: 40px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Corta si se sale */
}
.ad-box-style {
    display: block;
    background: var(--bg-sidebar);
    border: 1px dashed var(--border);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    max-width: 100%; /* Evita que empuje el ancho */
}
.ad-label {
    display: block; font-size: 10px; color: var(--text-muted);
    letter-spacing: 1px; margin-bottom: 10px; text-transform: uppercase;
}

/* --- SIDEBAR --- */
.sidebar { position: sticky; top: 90px; height: fit-content; }
.widget { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--radius); padding: 25px; margin-bottom: 30px; }
.widget-title { font-size: 18px; margin-bottom: 20px; border-left: 4px solid var(--primary); padding-left: 10px; color: var(--text-main); }
.sidebar-item { display: flex; gap: 15px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--border); align-items: center; }
.sidebar-item:last-child { border: none; padding: 0; margin: 0; }
.sidebar-item img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.sidebar-item-info h5 { font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; color: var(--text-main); }
.category-tag { font-size: 11px; color: var(--primary); font-weight: 700; text-transform: uppercase; }

/* --- JUEGOS --- */
.game-viewport { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 30px; box-shadow: 0 0 30px rgba(0,0,0,0.3); }
.game-viewport iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* --- FOOTER --- */
.site-footer { background: var(--bg-footer); color: var(--text-muted); padding: 60px 0 20px; margin-top: 80px; border-top: 1px solid var(--border); }
.footer-container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; }
.footer-logo { font-size: 28px; color: #fff; margin-bottom: 20px; display: block; }
.footer-title { color: #fff; margin-bottom: 20px; font-size: 18px; }
.footer-links li { margin-bottom: 10px; }
.footer-links a:hover { color: var(--primary); padding-left: 5px; }
.footer-bottom { text-align: center; margin-top: 50px; padding-top: 20px; border-top: 1px solid #333; font-size: 14px; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .layout-container { grid-template-columns: 1fr; } 
    .nav-desktop { display: none; } 
    .mobile-toggle { display: flex; } 
    .article-title { font-size: 2rem; }
}