﻿/* Estilos para el Kit de Aprendizaje HTML */
/* Estos estilos son solo para mejorar la presentaciÃ³n y ayudar a visualizar los conceptos */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 100px;
    /* Espacio para navbar fija */
    background-color: #f9f9f9;
}

/* Navbar styles (Importados de principal) */
.navbar {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    border-bottom: 1px solid #333;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    /* Fixed Dimensions to prevent layout shift */
    height: 90px;
    padding: 0;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.menu {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
}

.crystal-btn {
    text-decoration: none;
    color: white;
    font-weight: bold;
    text-transform: uppercase;

    /* Fixed Dimensions */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 25px;
    box-sizing: border-box;

    border-radius: 15px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.crystal-btn:hover {
    background: rgba(40, 40, 40, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

h1,
h2,
h3 {
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* code {
    background-color: #000000;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #39ff14;
} */

code {
    color: black;
    font-weight: bolder;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    background-color: #f4f4f4
}


pre {
    /* background-color: #000000; */
    background-color: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    position: relative;
    border: 1px solid #ddd;
}

/* Estilos para comentarios de código (pantalla) */
.comment {
    color: #00CED1 !important;
    /* Cyan (DarkTurquoise) para pantalla con fondo oscuro */
    font-style: italic;
}

.ejemplo {
    border: 1px solid #ddd;
    padding: 15px;
    margin: 15px 0;
    background-color: #fff;
    border-radius: 5px;
}

/* VisualizaciÃ³n de Bloque vs LÃ­nea */
.demo_bloque {
    background-color: #e3f2fd;
    border: 1px solid #2196f3;
    padding: 10px;
    margin-bottom: 5px;
}

.demo_linea {
    background-color: #fff3e0;
    border: 1px solid #ff9800;
    padding: 5px;
}

/* Estilos para Tablas */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th,
td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* NavegaciÃ³n Local (excluyendo la navbar global) */
nav:not(.navbar) ul {
    list-style-type: none;
    padding: 0;
    background-color: #333;
    overflow: hidden;
    border-radius: 5px;
}

nav:not(.navbar) li {
    float: left;
}

nav:not(.navbar) li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

nav:not(.navbar) li a:hover {
    background-color: #111;
}

/* Estados activos de navegaciÃ³n local */
nav:not(.navbar) li a.activo_html {
    background-color: #e34f26;
    color: white;
}

nav:not(.navbar) li a.activo_css {
    background-color: #264de4;
    color: white;
}

nav:not(.navbar) li a.activo_js {
    background-color: #f7df1e;
    color: #323330;
}

/* Botones de navegaciÃ³n */
.volver,
.boton_arriba {
    display: inline-block;
    padding: 10px 15px;
    background-color: #2c3e50;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.volver {
    margin-top: 20px;
    background-color: #666;
}

.boton_arriba {
    margin-bottom: 10px;
    font-size: 0.9em;
}

.volver:hover,
.boton_arriba:hover {
    background-color: #34495e;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.volver:visited,
.boton_arriba:visited {
    color: white;
}

/* Footer y Copyleft */
.copyleft {
    display: inline-block;
    transform: rotate(180deg);
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    color: #666;
    border-top: 1px solid #eee;
}

/* Estilos para el botÃ³n de copiar (Global) */
.boton_copiar {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75em;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    opacity: 0.7;
    z-index: 10;
    font-family: 'Segoe UI', sans-serif;
}

.boton_copiar:hover {
    opacity: 1;
    background: #f0f0f0;
    color: #000;
}

.boton_copiar.copied {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.valores_lista {
    position: relative;
}

/* Cabeceras de SecciÃ³n */
.encabezado_html {
    background-color: #e34f26;
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
}

.encabezado_html h1 {
    color: white;
    border-bottom: none;
}

.encabezado_css {
    background-color: #264de4;
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
}

.encabezado_css h1 {
    color: white;
    border-bottom: none;
}

.encabezado_js {
    background-color: #f7df1e;
    color: #323330;
    padding: 40px 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
}

.encabezado_js h1 {
    color: #323330;
    border-bottom: none;
    margin: 0;
    font-size: 2.5em;
}

.encabezado_js p {
    font-size: 1.2em;
    margin-top: 10px;
}

/* Estilos de PÃ¡gina de Inicio (Landing) */
.contenedor_inicio {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.tarjeta_inicio {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    padding: 30px 20px;
    text-align: center;
    background: white;
    border: 2px solid #ddd;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tarjeta_inicio:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.tarjeta_inicio.tarjeta_html:hover {
    border-color: #e34f26;
}

.tarjeta_inicio.tarjeta_css:hover {
    border-color: #264de4;
}

.tarjeta_inicio.tarjeta_js:hover {
    border-color: #f7df1e;
}

.icono_inicio {
    font-size: 3em;
    margin-bottom: 15px;
    display: block;
}

.tarjeta_inicio h2 {
    font-size: 1.8em;
    margin-bottom: 8px;
    border-bottom: none;
}

.tarjeta_inicio.tarjeta_html h2 {
    color: #e34f26;
}

.tarjeta_inicio.tarjeta_css h2 {
    color: #264de4;
}

.tarjeta_inicio.tarjeta_js h2 {
    color: #f7df1e;
    text-shadow: 1px 1px 0 #333;
}

.tarjeta_inicio p {
    font-size: 0.95em;
    color: #666;
    line-height: 1.4;
}

/* Responsive: en mÃ³viles, las tarjetas se apilan */
@media (max-width: 768px) {
    .contenedor_inicio {
        flex-direction: column;
        align-items: center;
    }

    .tarjeta_inicio {
        max-width: 100%;
        width: 100%;
    }
}

/* Estilos de CuadrÃ­cula de MÃ³dulos */
.cuadricula_modulos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tarjeta_modulo {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.tarjeta_modulo:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Hover especÃ­fico para cada secciÃ³n */
.encabezado_html~main .tarjeta_modulo:hover {
    border-color: #e34f26;
}

.encabezado_css~main .tarjeta_modulo:hover {
    border-color: #264de4;
}

.encabezado_js~main .tarjeta_modulo:hover {
    border-color: #f7df1e;
}

.numero_modulo {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

.titulo_modulo {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: #323330;
    font-weight: bold;
}

.descripcion_modulo {
    font-size: 0.95em;
    color: #555;
    flex-grow: 1;
}

.boton_empezar {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 15px;
    color: white;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

/* BotÃ³n empezar especÃ­fico para cada secciÃ³n */
.encabezado_html~main .boton_empezar {
    background-color: #e34f26;
}

.encabezado_css~main .boton_empezar {
    background-color: #264de4;
}

.encabezado_js~main .boton_empezar {
    background-color: #f7df1e;
    color: #000000;
}

.texto_intro {
    font-size: 1em;
    color: #555;
    margin-bottom: 20px;
}

/* Estilos especÃ­ficos para la pÃ¡gina de inicio */
.encabezado_inicio {
    text-align: center;
    padding: 40px 0;
}

.pie_inicio {
    margin-top: 50px;
    text-align: center;
    color: #666;
}

/* Estilos para formularios */
.form_group {
    margin-bottom: 15px;
}

.form_group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form_group input,
.form_group select,
.form_group textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

.inline_group label {
    display: inline;
    font-weight: normal;
    margin-left: 5px;
}

.inline_group input {
    width: auto;
}

fieldset {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    background-color: #fcfcfc;
}

legend {
    font-weight: bold;
    color: #2196f3;
    padding: 0 5px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
}

.btn_primary {
    background-color: #2196f3;
    color: white;
}

.btn_secondary {
    background-color: #666;
    color: white;
}

.btn_danger {
    background-color: #f44336;
    color: white;
}

input:invalid {
    border-color: #f44336;
}

input:valid {
    border-color: #4caf50;
}

form:not(:focus-within) input:invalid {
    border-color: #ccc;
}

/* ImÃ¡genes responsive */
.ejemplo img {
    max-width: 100%;
    height: auto;
}

/* --- Estilos para la SecciÃ³n de Ejercicios --- */
.seccion_ejercicios {
    margin-top: 50px;
    padding: 30px;
    background-color: #fff;
    border-top: 4px solid #333;
    border-radius: 8px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.seccion_ejercicios h2 {
    color: #333;
    border-bottom: 2px solid #333;
    margin-bottom: 25px;
}

.contenedor_ejercicio {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.contenedor_ejercicio h3 {
    margin-top: 0;
    color: #444;
    font-size: 1.3em;
    border-bottom: 1px solid #eee;
}

.enunciado {
    margin-bottom: 15px;
    font-size: 1.05em;
}

.area_trabajo {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .area_trabajo {
        flex-direction: row;
    }
}

.columna_editor,
.columna_resultado {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.label_editor {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
    color: #555;
}

.editor_codigo {
    width: 100%;
    height: 200px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

.controles_editor {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.btn_ejecutar {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn_ejecutar:hover {
    background-color: #45a049;
}

.btn_solucion {
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn_solucion:hover {
    background-color: #fb8c00;
}

.resultado_contenedor {
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    height: 200px;
    overflow: hidden;
}

.marco_resultado {
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

.inline_group label {
    display: inline;
    font-weight: normal;
    margin-left: 5px;
}

.inline_group input {
    width: auto;
}

fieldset {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    background-color: #fcfcfc;
}

legend {
    font-weight: bold;
    color: #2196f3;
    padding: 0 5px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
}

.btn_primary {
    background-color: #2196f3;
    color: white;
}

.btn_secondary {
    background-color: #666;
    color: white;
}

.btn_danger {
    background-color: #f44336;
    color: white;
}

input:invalid {
    border-color: #f44336;
}

input:valid {
    border-color: #4caf50;
}

form:not(:focus-within) input:invalid {
    border-color: #ccc;
}

/* ImÃ¡genes responsive */
.ejemplo img {
    max-width: 100%;
    height: auto;
}

/* --- Estilos para la SecciÃ³n de Ejercicios --- */
.seccion_ejercicios {
    margin-top: 50px;
    padding: 30px;
    background-color: #fff;
    border-top: 4px solid #333;
    border-radius: 8px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.seccion_ejercicios h2 {
    color: #333;
    border-bottom: 2px solid #333;
    margin-bottom: 25px;
}

.contenedor_ejercicio {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.contenedor_ejercicio h3 {
    margin-top: 0;
    color: #444;
    font-size: 1.3em;
    border-bottom: 1px solid #eee;
}

.enunciado {
    margin-bottom: 15px;
    font-size: 1.05em;
}

.area_trabajo {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .area_trabajo {
        flex-direction: row;
    }
}

.columna_editor,
.columna_resultado {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.label_editor {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
    color: #555;
}

.editor_codigo {
    width: 100%;
    height: 200px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

.controles_editor {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.btn_ejecutar {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn_ejecutar:hover {
    background-color: #45a049;
}

.btn_solucion {
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn_solucion:hover {
    background-color: #fb8c00;
}

.resultado_contenedor {
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    height: 200px;
    overflow: hidden;
}

.marco_resultado {
    width: 100%;
    height: 100%;
    border: none;
}

.solucion_contenedor {
    margin-top: 20px;
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    padding: 15px;
}

.solucion_contenedor h4 {
    margin-top: 0;
    color: #2e7d32;
}

/* Clase para ocultar elementos */
.oculto {
    display: none;
}

.inline_group input {
    width: auto;
}

/* ========================================
   ESTILOS PARA PÁGINA DE SELECTORES CSS
   ======================================== */

/* Contenedor principal de selectores */
.contenedor_selectores {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Encabezado de selectores */
.encabezado_selectores {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.encabezado_selectores h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: white;
    border-bottom: none;
}

.encabezado_selectores p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Contenido de selectores */
.contenido_selectores {
    padding: 40px;
}

/* Secciones de selectores */
.seccion_selectores {
    margin-bottom: 50px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #667eea;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.seccion_selectores:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.seccion_selectores h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.seccion_selectores h3 {
    color: #764ba2;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.5em;
}

/* Bloques de código de selectores */
.codigo_selectores {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    overflow-x: auto;
    margin: 15px 0;
    border-left: 4px solid #667eea;
}

.codigo_selectores .selector_css {
    color: #66d9ef;
}

.codigo_selectores .propiedad_css {
    color: #a6e22e;
}

.codigo_selectores .valor_css {
    color: #e6db74;
}

.codigo_selectores .comentario_css {
    color: #75715e;
    font-style: italic;
}

/* Demos de selectores */
.demo_selectores {
    background: #fff;
    border: 3px dashed #667eea;
    border-radius: 10px;
    padding: 25px;
    margin: 20px 0;
}

/* Notas de selectores */
.nota_selectores {
    background: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.nota_selectores strong {
    color: #856404;
}

/* 1. SELECTORES BÁSICOS - Demos */

/* Universal */
.demo_universal * {
    border: 1px dotted #999;
    padding: 5px;
}

/* Elemento */
.demo_elemento p {
    color: #2c3e50;
    background: #ecf0f1;
    padding: 10px;
    margin: 5px 0;
}

/* Clase */
.destacado_ejemplo {
    background: #f39c12;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

/* ID */
#unico_ejemplo {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

/* Agrupación */
.demo_agrupacion h1,
.demo_agrupacion h2,
.demo_agrupacion h3 {
    color: #3498db;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

/* 2. SELECTORES COMBINADOS - Demos */

/* Descendiente */
.demo_descendiente div p {
    color: #e74c3c;
    font-weight: bold;
}

/* Hijo directo */
.demo_hijo>p {
    background: #3498db;
    color: white;
    padding: 10px;
    border-radius: 5px;
}

/* Hermano adyacente */
.demo_adyacente h3+p {
    background: #2ecc71;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-style: italic;
}

/* Hermanos generales */
.demo_generales h3~p {
    border-left: 4px solid #9b59b6;
    padding-left: 15px;
    margin-left: 10px;
}

/* 3. SELECTORES DE ATRIBUTO - Demos */

.demo_atributos a[href^="https"] {
    color: #27ae60;
    font-weight: bold;
}

.demo_atributos a[href$=".pdf"] {
    color: #e74c3c;
}

.demo_atributos a[href*="google"] {
    background: #f39c12;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    text-decoration: none;
}

.demo_atributos input[type="text"] {
    border: 2px solid #3498db;
    padding: 8px;
    border-radius: 5px;
}

.demo_atributos input[type="email"] {
    border: 2px solid #e74c3c;
    padding: 8px;
    border-radius: 5px;
}

.demo_atributos input[disabled] {
    background: #ecf0f1;
    cursor: not-allowed;
}

/* 4. PSEUDO-CLASES DE ESTADO - Demos */

.demo_estado a:link {
    color: #3498db;
}

.demo_estado a:visited {
    color: #9b59b6;
}

.demo_estado a:hover {
    color: #e74c3c;
    text-decoration: none;
}

.demo_estado a:active {
    color: #c0392b;
}

.demo_estado button:hover {
    background: #2ecc71;
    transform: scale(1.05);
    transition: all 0.3s ease;
}

.demo_estado input:focus {
    outline: 3px solid #3498db;
    border-color: #3498db;
}

.demo_estado input:disabled {
    background: #ecf0f1;
    cursor: not-allowed;
}

.demo_estado input[type="checkbox"]:checked+label {
    color: #2ecc71;
    font-weight: bold;
}

/* 5. PSEUDO-CLASES ESTRUCTURALES - Demos */

.demo_estructurales li:first-child {
    background: #3498db;
    color: white;
    padding: 10px;
    border-radius: 5px;
}

.demo_estructurales li:last-child {
    background: #e74c3c;
    color: white;
    padding: 10px;
    border-radius: 5px;
}

.demo_estructurales li:nth-child(even) {
    background: #ecf0f1;
}

.demo_estructurales li:nth-child(odd) {
    background: #bdc3c7;
}

.demo_estructurales li:hover {
    transform: scale(1.05);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.demo_estructurales2 p:first-of-type {
    font-size: 1.2em;
    color: #3498db;
    font-weight: bold;
}

.demo_estructurales2 p:last-of-type {
    font-style: italic;
    color: #7f8c8d;
}

.demo_estructurales2 div:only-child {
    background: #f39c12;
    color: white;
    padding: 10px;
}

.demo_estructurales2 p:empty {
    background: #e74c3c;
    height: 20px;
    display: block;
}

/* 6. PSEUDO-CLASES AVANZADAS - Demos */

.demo_avanzadas p:not(.especial_ejemplo) {
    color: #7f8c8d;
}

.demo_avanzadas .especial_ejemplo {
    background: #f39c12;
    color: white;
    padding: 10px;
    border-radius: 5px;
}

.demo_avanzadas :is(h1, h2, h3) {
    color: #3498db;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

/* 7. PSEUDO-ELEMENTOS - Demos */

.demo_pseudoelementos p::first-line {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2em;
}

.demo_pseudoelementos p::first-letter {
    font-size: 3em;
    float: left;
    line-height: 0.8;
    margin-right: 5px;
    color: #764ba2;
}

.demo_pseudoelementos .con_before::before {
    content: "? ";
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.5em;
}

.demo_pseudoelementos .con_after::after {
    content: " ?";
    color: #2ecc71;
    font-weight: bold;
    font-size: 1.5em;
}

.demo_pseudoelementos ::selection {
    background: #667eea;
    color: white;
}

.demo_pseudoelementos ul li::marker {
    color: #e74c3c;
    font-size: 1.5em;
}

.demo_pseudoelementos input::placeholder {
    color: #95a5a6;
    font-style: italic;
}

/* TABLA DE REFERENCIA DE SELECTORES */

.tabla_selectores {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tabla_selectores thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tabla_selectores th,
.tabla_selectores td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.tabla_selectores th {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 1px;
}

.tabla_selectores tbody tr:hover {
    background: #f8f9fa;
    transition: background 0.3s ease;
}

.tabla_selectores tbody tr:last-child td {
    border-bottom: none;
}

/* Especificidad de selectores */

.especificidad_selectores {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.especificidad_ejemplo {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    margin: 10px 0;
}

.especificidad_valor {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-family: monospace;
    margin-left: 10px;
}

/* Estilos para botones de ejemplo en selectores */
.demo_selectores button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin: 5px;
}

.demo_selectores input[type="text"],
.demo_selectores input[type="email"] {
    margin: 5px;
}

/* Estilos para el botón de donación */
.donacion-container {
    margin-top: 20px;
    margin-bottom: 10px;
    text-align: center;
}

.btn-donacion {
    display: inline-block;
    padding: 10px 20px;
    background-color: #ffc439;
    color: #000;
    text-decoration: none;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e6b800;
}

.btn-donacion:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #ffb700;
}

/* Estilos para la fecha de última actualización */
.ultima-actualizacion {
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
    margin-top: 10px;
}

/* Botón lateral fijo para volver al índice */
.btn-lateral-fixed {
    display: none;
    /* Oculto por defecto en móviles */
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    writing-mode: vertical-rl;
    background-color: #3498db;
    color: white;
    padding: 15px 10px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 10px 10px 0;
    /* Bordes redondeados hacia adentro */
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: background-color 0.3s, transform 0.3s;
    letter-spacing: 2px;
}

.btn-lateral-fixed:hover {
    background-color: #2980b9;
}

@media (min-width: 1100px) {

    /* 800px contenido + margen para no solapar */
    .btn-lateral-fixed {
        display: block;
    }
}

/* Corrección: Bajar breakpoint para que se vea en más pantallas */
@media (min-width: 900px) {
    .btn-lateral-fixed {
        display: block;
    }
}

/* Colores específicos por sección para el botón lateral */
/* HTML: Naranja */
.btn-lateral-fixed[href='html.html'] {
    background-color: #e44d26;
}

.btn-lateral-fixed[href='html.html']:hover {
    background-color: #c73814;
}

/* JS: Amarillo */
.btn-lateral-fixed[href='javascript.html'] {
    background-color: #f1c40f;
    color: #333;
    /* Texto oscuro para contraste */
}

.btn-lateral-fixed[href='javascript.html']:hover {
    background-color: #f39c12;
}

/* CSS: Azul (por defecto es azul, pero forzamos por si acaso) */
.btn-lateral-fixed[href='css.html'] {
    background-color: #3498db;
}

.btn-lateral-fixed[href='css.html']:hover {
    background-color: #2980b9;
}


/* Botón 'Ver Código' */
.btn-ver-codigo {
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    color: #333;
    padding: 5px 10px;
    font-size: 0.85em;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 5px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.btn-ver-codigo:hover {
    background-color: #e2e6ea;
    border-color: #adb5bd;
}

/* Contenedor de código desplegable */
.codigo-desplegable {
    display: none;
    background-color: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-top: 10px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    border-left: 4px solid #61afef;
}

.codigo-desplegable.visible {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Secciones de código HTML/CSS */
.code-section {
    position: relative;
    margin-bottom: 20px;
}

.code-label {
    background: #e0e0e0;
    color: #333;
    padding: 2px 10px;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 4px 4px 0 0;
    display: inline-block;
    margin-left: 10px;
}

.code-section pre {
    border-radius: 5px;
    margin-top: 0;
}


@media (max-width: 600px) {
    .crystal-btn {
        height: 36px;
        padding: 0 12px;
        font-size: 0.85em;
    }

    .btn-text {
        display: none;
    }
}

.active-gold {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5), inset 0 0 5px rgba(255, 215, 0, 0.5);
    color: #ffd700;
    pointer-events: none;
    text-shadow: 0 0 5px #ffd700;
}

/* --- Utilidades de Grid para Comparaciones --- */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}

.compare-grid>div {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: #fafafa;
}

.good {
    background-color: #e8f5e9 !important;
    border-color: #4caf50 !important;
}

.bad {
    background-color: #ffebee !important;
    border-color: #ef5350 !important;
}

.bad::before {
    content: "❌ MAL";
    display: block;
    font-weight: bold;
    color: #c62828;
    margin-bottom: 5px;
}

.good::before {
    content: "✅ BIEN";
    display: block;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 5px;
}

@media (max-width: 600px) {
    .compare-grid {
        grid-template-columns: 1fr;
    }
}

/* --- ESTILOS DE IMPRESIÓN (GLOBAL) --- */
@media print {
    @page {
        size: auto;
        margin: 1.5cm;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        color: black !important;
        font-family: 'Segoe UI', serif !important;
        /* Serif para mejor lectura en papel */
    }

    /* 1. OCULTAR ELEMENTOS INTERACTIVOS Y DE NAVEGACIÓN */
    .navbar,
    nav,
    .encabezado_js,
    footer,
    .btn-lateral-fixed,
    .btn,
    button,
    .contenedor-botones,
    .zona-entrenamiento,
    .ejercicios-container,
    .ejemplo,
    #arena,
    .btn-ver-codigo,
    .copyleft,
    .donacion-container,
    .ultima-actualizacion,
    a[href^="../"],
    span.boton_empezar {
        display: none !important;
    }

    /* Ocultar botones específicos por si acaso */
    [onclick],
    [class*="btn-"],
    [class*="boton"] {
        display: none !important;
    }

    /* 2. MAQUETACIÓN LIMPIA */
    main,
    section,
    article {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Ajustes Grid Chuleta */
    .chuleta-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 15px !important;
        page-break-inside: auto;
        /* Permitir romper grid si es necesario */
    }

    .chuleta-card {
        border: 1px solid #333 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        /* Evitar partir tarjetas por la mitad */
        margin-bottom: 10px;
        background: white !important;
    }

    /* 3. CÓDIGO PRINT-FRIENDLY */
    /* Bloques de código (con borde) */
    pre,
    .syntax-snippet {
        background-color: white !important;
        color: black !important;
        border: 1px solid #888 !important;
        padding: 5px !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        word-break: normal !important;
        /* Evitar romper palabras innecesariamente */
        box-shadow: none !important;
        width: 100% !important;
        /* Ocupar todo el ancho disponible */
        max-width: 100%;
        border-radius: 4px !important;
        display: block;
        margin: 5px 0;
        text-align: left !important;
        /* Asegurar alineación izquierda */
        page-break-inside: avoid;
        /* Evitar que el bloque se parta entre páginas */
        orphans: 3;
        /* Mínimo 3 líneas al final de página */
        widows: 3;
        /* Mínimo 3 líneas al inicio de página */
    }

    /* Código en línea (sin borde, integrado en texto) */
    code {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        width: auto !important;
        color: black !important;
        box-shadow: none !important;
        word-wrap: break-word !important;
    }

    /* Párrafos y contenido general */
    p,
    li,
    div {
        orphans: 3;
        /* Mínimo 3 líneas al final de página */
        widows: 3;
        /* Mínimo 3 líneas al inicio de página */
    }

    /* Colores sintaxis (Alto Contraste para Papel) */
    .keyword {
        color: #5a00b3 !important;
        font-weight: bold;
    }

    /* Morado */
    .string {
        color: #00008b !important;
    }

    /* Azul oscuro */
    .number {
        color: #993300 !important;
    }

    /* Marrón rojizo */

    /* COMENTARIOS EN VERDE OSCURO */
    .comment {
        color: #006400 !important;
        /* Verde oscuro */
        font-style: italic;
    }

    /* 4. HEADER Y FOOTER PERSONALIZADOS (SOLO IMPRESIÓN) */
    body::before {
        content: "Apuntes JavaScript - Blackchorima.com 2026";
        display: block;
        text-align: center;
        border-bottom: 2px solid #333;
        margin-bottom: 20px;
        font-weight: bold;
        font-size: 14pt;
        padding-bottom: 5px;
    }

    body::after {
        content: "🄯 Blackchorima.com 2026 - Copyleft (Libre Distribución)";
        display: block;
        text-align: center;
        border-top: 1px solid #aaa;
        margin-top: 30px;
        padding-top: 5px;
        font-size: 9pt;
        color: #555;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        /* Para tapar contenido si se solapa */
    }

    /* Títulos legibles */
    h1,
    h2,
    h3,
    h4 {
        color: black !important;
        page-break-after: avoid;
    }

    h2 {
        border-bottom: 2px solid black !important;
    }
}