/* === Botones globales === */
.btn-global {
    background: #114e85;
    color: #fff;
    border: 2px solid #032854;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(3,40,84,0.08);
}
.btn-global:hover, .btn-global:focus {
    background: #032854;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17,78,133,0.18);
}

/* === style.css === */
/* Variables y temas */
:root {
    --gradient-body: linear-gradient(135deg, #c4dff3 0%, #2b9df4 100%);
    --gradient-expandible-root: linear-gradient(135deg, #032854 0%, #165f9d 100%);
    --gradient-depth-1: linear-gradient(135deg, #165f9d 0%, #114e85 100%);
    --gradient-depth-2: linear-gradient(135deg, #114e85 0%, #2b9df4 100%);
    --gradient-depth-3: linear-gradient(135deg, #2b9df4 0%, #c4dff3 100%);
    --gradient-leaf: linear-gradient(135deg, #c4dff3 0%, #ffffff 100%);
    --color-primary: #114e85;
    --color-primary-dark: #032854;
    --color-surface: #165f9d;
    --color-surface-alt: #2b9df4;
    --color-border: #032854;
    --color-text-dark: #032854;
    --color-text-light: #114e85;
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 15px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 20px;
    --transition-fast: 0.3s ease;
    --transition-slow: 0.4s ease-in-out;
    --shadow-sm: 0 2px 5px rgba(3,40,84,0.08);
    --shadow-md: 0 4px 12px rgba(17,78,133,0.12);
    --shadow-card: 0 10px 40px rgba(22,95,157,0.18);
    --focus-ring: 0 0 0 3px rgba(43,157,244,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: #c4dff3;
    color: var(--color-primary-dark);
    padding: var(--space-lg);
    min-height: 100vh;
}


h1 {
    color: #032854;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px #c4dff3;
    font-size: 2.5em;
}


p {
    color: #114e85;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* El contenedor principal del árbol */
#visor-arbol {
    background: rgba(3,40,84,0.10);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: auto;
}

/* Estilos para las listas (UL) y elementos (LI) */
#visor-arbol ul {
    list-style-type: none;
    padding-left: 30px;
    margin-top: 10px;
}

#visor-arbol > ul {
    padding-left: 0;
}

#visor-arbol li {
    padding: 8px 0;
    position: relative;
}

/* Líneas conectoras (efecto de mapa conceptual) */
#visor-arbol li.expandible::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 20px;
    width: 15px;
    height: 1px;
    background: #cbd5e0;
}

/* El "span" que contiene el título */
#visor-arbol span.titulo {
    position: relative;
    display: inline-block;
    padding: 12px 20px;
    border-radius: 8px;
    background: linear-gradient(135deg, #114e85 0%, #165f9d 100%);
    border: 2px solid #032854;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(3,40,84,0.08);
    color: #fff;
}

#visor-arbol span.titulo:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(43,157,244,0.18);
}

/* Descripción adicional (si existe) */
#visor-arbol .descripcion {
    display: block;
    margin-top: 5px;
    padding: 10px 15px;
    background: #165f9d;
    border-left: 3px solid #2b9df4;
    border-radius: 5px;
    font-size: 0.9em;
    color: #fff;
    font-style: italic;
}

/* * Ocultamos los sub-árboles (hijos) por defecto */
#visor-arbol .hijos {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
}

/* Cuando un elemento SÍ tiene hijos */
#visor-arbol li.expandible > span.titulo {
    cursor: pointer;
    background: var(--gradient-expandible-root);
    color: #fff;
    border-color: #2b9df4;
    font-weight: 600;
}

#visor-arbol li.expandible > span.titulo:hover {
    background: linear-gradient(135deg, #2b9df4 0%, #165f9d 100%);
    transform: translateX(8px) scale(1.02);
}

/* Estado de foco accesible */
#visor-arbol span.titulo:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), var(--shadow-sm);
}

/* Indicador de flecha */
#visor-arbol li.expandible > span.titulo::before {
    content: '▶';
    margin-right: 10px;
    font-size: 0.9em;
    display: inline-block;
    transition: transform 0.3s ease;
}

/* ESTADO EXPANDIDO */
#visor-arbol li.expandido > .hijos {
    display: block;
    opacity: 1;
    max-height: 10000px;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Rotación de la flecha */
#visor-arbol li.expandido > span.titulo::before {
    transform: rotate(90deg);
}

/* Niveles de profundidad con diferentes colores */
#visor-arbol > ul > li > span.titulo {
    font-size: 1.2em;
    padding: 15px 25px;
}

#visor-arbol ul ul li.expandible > span.titulo {
    background: var(--gradient-depth-1);
}

#visor-arbol ul ul li.expandible > span.titulo { background: var(--gradient-depth-1); }
#visor-arbol ul ul ul li.expandible > span.titulo { background: var(--gradient-depth-2); }
#visor-arbol ul ul ul ul li.expandible > span.titulo { background: var(--gradient-depth-3); }
#visor-arbol li:not(.expandible) > span.titulo {
    background: var(--gradient-leaf);
    border-left: 4px solid #2b9df4;
    color: #032854;
}

#visor-arbol li:not(.expandible) > span.titulo:hover {
    background: linear-gradient(135deg, #c4dff3 0%, #2b9df4 100%);
    border-left-color: #114e85;
}

/* Scroll suave */
#visor-arbol {
    scroll-behavior: smooth;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }
    
    #visor-arbol {
        padding: 20px 15px;
    }
    
    #visor-arbol ul {
        padding-left: 20px;
    }
}

/* === Paralelas (dos columnas lado a lado) === */
#visor-arbol .paralelas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    align-items: start;
    margin-top: 12px;
}

#visor-arbol .paralelas .columna {
    background: rgba(17,78,133,0.08);
    border: 1px solid #165f9d;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(22,95,157,0.08);
}

#visor-arbol .paralelas .columna h4 {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #114e85;
    border-left: 4px solid #2b9df4;
    padding-left: 8px;
}

/* Modo de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }
}

/* Foco para botones globales (si se aplican estilos externos) */
button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Para que las listas internas no agreguen mucha sangría dentro de columnas */
#visor-arbol .paralelas .columna > ul {
    padding-left: 14px;
}