/* =========================
   Variables de color (modo claro / oscuro)
   ========================= */
:root {
    --bg: #f5f5f7;
    --text: #222;
    --card: #ffffff;
    --nav: #1f2933;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --success: #22c55e;
}

.dark {
    --bg: #0f172a;
    --text: #e2e8f0;
    --card: #1e293b;
    --nav: #020617;
    --accent: #3b82f6;
    --accent-soft: #1e293b;
    --success: #22c55e;
}

/* =========================
   Base
   ========================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* =========================
   Menú superior
   ========================= */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left a {
    color: #e5e7eb;
    text-decoration: none;
    margin-right: 1rem;
    font-size: 0.95rem;
}

.nav-left a.logo {
    font-weight: 700;
    margin-right: 2rem;
}

.nav-left a.active {
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
}

.nav-right .dark-btn {
    background: transparent;
    border: 1px solid #4b5563;
    color: #e5e7eb;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* =========================
   Layout general (lecciones)
   ========================= */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: 220px;
    padding: 1rem;
    font-size: 0.9rem;
}

.sidebar h3 {
    margin-top: 0;
    font-size: 1rem;
}

.sidebar ul {
    list-style: none;
    padding-left: 0;
}

.sidebar li {
    margin-bottom: 0.35rem;
}

.sidebar a {
    color: var(--text);
    text-decoration: none;
}

.sidebar a:hover {
    text-decoration: underline;
}

main {
    margin-left: 240px;
    padding: 2rem 2rem 4rem 2rem;
    max-width: 900px;
}

/* =========================
   Tarjetas / secciones
   ========================= */
section {
    background: var(--card);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

h1, h2, h3 {
    margin-top: 0;
}

/* Código */
pre {
    background: #020617;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
}

code {
    background: var(--accent-soft);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: "Fira Code", Consolas, monospace;
}

/* =========================
   Ejercicios interactivos
   ========================= */
.exercise {
    background: var(--card);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(148,163,184,0.4);
}

.btn-check {
    padding: 0.45rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.btn-check:hover {
    opacity: 0.9;
}

.result {
    margin-top: 0.5rem;
    font-weight: 600;
}

/* =========================
   Bloque "Siguiente lección"
   ========================= */
.next-lesson {
    border-left: 4px solid var(--accent);
}

.btn-next {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.6rem 1.4rem;
    background: var(--success);
    color: #022c22;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* =========================
   Página de inicio (index)
   ========================= */
main.home {
    margin-left: 0;
    max-width: 900px;
    padding: 2rem 1.5rem 4rem 1.5rem;
    margin: 0 auto;
}

.intro-card {
    background: var(--card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    margin-bottom: 2rem;
}

.lessons, .extras {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.lesson-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.lesson-list li {
    margin-bottom: 0.6rem;
}

.lesson-list a {
    text-decoration: none;
    color: var(--accent);
    font-weight: 500;
}

.lesson-list a:hover {
    text-decoration: underline;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    main {
        margin-left: 0;
        padding: 1.5rem 1rem 3rem 1rem;
    }
}

@media (max-width: 600px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-left a {
        display: inline-block;
        margin-bottom: 0.25rem;
    }
}
.code-box {
    background: #020617;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 8px;
    font-family: "Fira Code", Consolas, monospace;
    margin-bottom: 1rem;
    line-height: 1.5;
}
/* Banner de cookies */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #1e293b;
    z-index: 9999;
}

.cookie-buttons button {
    margin-left: 0.5rem;
}

/* Modal */
.cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.cookie-modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    color: #e2e8f0;
}

.cookie-modal-content label {
    display: block;
    margin: 1rem 0;
}