:root {
    /* LIGHT MODE COLORS */
    --primary-blue: #0062be;
    --primary-orange: #ff8c00;
    --bg-body: #ffffff;
    --bg-sidebar: #f9fafb;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --header-bg: rgba(255, 255, 255, 0.9);
    --badge-bg: #eff6ff;
    --icon-bg: #eff6ff;
    --sidebar-width: 280px;
    --header-height: 70px;
}

/* DARK MODE COLORS */
[data-theme="dark"] {
    --bg-body: #0b0f1a;
    --bg-sidebar: #111827;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --header-bg: rgba(11, 15, 26, 0.9);
    --badge-bg: #1e293b;
    --icon-bg: rgba(59, 130, 246, 0.1);
    --primary-blue: #3b82f6;
}

* { margin: 0; padding: 0; box-sizing: border-box; scroll-behavior: smooth; }
ul { list-style: none !important; }

/* Ajuste para que los títulos no queden bajo la cabecera al navegar */
[id] { scroll-margin-top: 110px; }

body { 
    font-family: 'Pathway Extreme', sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main);
    display: flex;
    transition: background 0.3s ease, color 0.3s ease;
}

/* SIDEBAR LEFT */
.sidebar {
    width: var(--sidebar-width); height: 100vh; background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color); padding: 32px 24px;
    position: fixed; left: 0; top: 0; z-index: 1000;
}
.logo { margin-bottom: 40px; }
.logo-img { max-width: 120px; transition: filter 0.3s; }
[data-theme="dark"] .logo-img { filter: brightness(0) invert(1); }

.nav-section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin: 24px 0 8px 12px; letter-spacing: 0.1em; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text-muted); text-decoration: none; border-radius: 8px; font-size: 15px; margin-bottom: 2px; transition: 0.2s; }
.nav-item.active, .nav-item:hover { background: var(--icon-bg); color: var(--primary-blue); font-weight: 600; }

/* MAIN WRAPPER */
.main-wrapper { margin-left: var(--sidebar-width); flex: 1; min-width: 0; }

/* TOP NAV */
.top-nav {
    position: fixed; top: 0; right: 0; width: calc(100% - var(--sidebar-width));
    height: var(--header-height); background: var(--header-bg);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 50px; z-index: 900;
}
.tab { text-decoration: none; color: var(--text-muted); font-size: 14px; font-weight: 500; margin-right: 30px; }
.tab.active { color: var(--primary-blue); border-bottom: 2px solid var(--primary-blue); padding: 25px 0; }

/* THEME TOGGLE */
.theme-toggle { background: none; border: none; cursor: pointer; color: var(--text-main); display: flex; padding: 8px; border-radius: 50%; transition: background 0.2s; }
.theme-toggle:hover { background: var(--icon-bg); }
.sun-icon { display: none; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* CONTENT */
.scroll-container { display: flex; padding-top: var(--header-height); }
.content { flex: 1; padding: 60px 50px; max-width: 1000px; }
.badge { background: var(--badge-bg); color: var(--primary-blue); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
h1 { font-size: 42px; margin: 8px 0; color: var(--text-main); letter-spacing: -0.02em; }
h3 { font-size: 18px; margin: 4px 0; color: var(--text-main); letter-spacing: -0.02em; }
.section-title { font-size: 26px; margin: 60px 0 25px; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }
.section-description { font-size: 16px; margin: 0 25px; padding-bottom: 15px; }

/* CARDS */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.card { border: 1px solid var(--border-color); border-radius: 16px; padding: 25px; background: var(--bg-card); transition: 0.3s; }
.card:hover { border-color: var(--primary-blue); transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.card-icon-wrapper { width: 45px; height: 45px; border-radius: 10px; background: var(--icon-bg); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.icon-blue { color: var(--primary-blue); }
.card-links a { color: var(--primary-blue); text-decoration: none; font-size: 14px; font-weight: 600; display: block; margin-bottom: 10px; }

/* VIDEO CARDS */
.card-video { border-left: 4px solid var(--primary-orange); }
.icon-orange-bg { background: rgba(255, 140, 0, 0.1) !important; }
.icon-orange { color: var(--primary-orange); }
.card-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.video-link { color: var(--primary-orange) !important; font-weight: 700 !important; text-decoration: none; }

/* TOC SIDEBAR (RIGHT) */
.on-the-page { width: 250px; padding: 60px 30px; position: sticky; top: var(--header-height); height: fit-content; }
.on-the-page h4 { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 20px; letter-spacing: 0.1em; }
.on-the-page ul { border-left: 1px solid var(--border-color); }
.on-the-page a { display: block; padding: 8px 20px; text-decoration: none; color: var(--text-muted); font-size: 14px; }
.on-the-page a.active { color: var(--primary-blue); border-left: 2px solid var(--primary-blue); margin-left: -1px; font-weight: 600; }

/* MOBILE RESPONSIVE */
.mobile-top-bar { display: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 100%; transition: 0.3s; z-index: 2000; background: var(--bg-sidebar); visibility: hidden; }
    .sidebar.open { transform: translateX(0); visibility: visible; }
    .main-wrapper { margin-left: 0; }
    .top-nav, .on-the-page { display: none; }
    .mobile-top-bar { display: flex; justify-content: space-between; align-items: center; height: 60px; padding: 0 20px; background: var(--bg-body); border-bottom: 1px solid var(--border-color); position: fixed; top: 0; width: 100%; z-index: 1500; }
    .mobile-actions { display: flex; align-items: center; gap: 10px; }
    .mobile-nav-btn { background: none; border: none; color: var(--primary-blue); font-size: 24px; cursor: pointer; }
    .content { padding: 100px 20px 40px; }
    h1 { font-size: 32px; }
}