/* --- Estilos base compartidos para todas las visualizaciones --- */

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #111;
    color: #eee;
}

.viz-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.viz-header {
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 680px;
}

.viz-header h1 {
    font-size: 14px;
    margin: 0 0 4px;
    font-weight: 600;
}

.viz-header p {
    margin: 0;
    font-size: 11px;
    line-height: 1.3;
}

/* Leyenda genérica */

.legend {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.legend-color {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

/* Filtros (inputs, botones, sliders) */

.filters {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 11px;
}

.filters label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.filters input[type="number"] {
    width: 70px;
    padding: 2px 4px;
    font-size: 11px;
    background: #222;
    border: 1px solid #444;
    color: #eee;
    border-radius: 3px;
}

.filters button {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 3px;
    border: 1px solid #555;
    background: #333;
    color: #eee;
    cursor: pointer;
}

.filters button:hover {
    background: #555;
}

.scale-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.scale-wrapper input[type="range"] {
    width: 100px;
}

.scale-value {
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.person-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.person-wrapper select {
    max-width: 220px;
    font-size: 11px;
    padding: 2px 4px;
    background: #222;
    border-radius: 3px;
    border: 1px solid #444;
    color: #eee;
}

/* Estadísticas pequeñas */

.stats {
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.85;
}

/* SVG genérico */

svg {
    width: 100%;
    height: 100%;
    background: #111;
}

/* Force-directed genérico */

.link {
    stroke-opacity: 0.5;
}

.node .marker {
    stroke: #111;
    stroke-width: 1px;
}

.node text {
    font-size: 9px;
    fill: #fff;
    pointer-events: none;
}

/* Tooltip genérico */

.tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 11px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.15s ease-out;
    max-width: 260px;
}

/* --- Específico para Sankey (viz02) --- */

/* Estilo general de links (puedes dejarlo neutro) */
.sankey-link {
    fill: none;
    stroke: rgba(255, 255, 255, 0.25);
    stroke-opacity: 0.25;
}

.sankey-link:hover {
    stroke-opacity: 0.6;
}

/* Texto de etiquetas del Sankey */
.sankey-label {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 11px;
    fill: #fff;
    font-weight: 300;
}

/* Contenedor con espacio para la cabecera */
#sankey-wrapper {
    padding-top: 180px;
    padding-bottom: 60px;
    width: 100%;
    height: 100%;
    position: relative;
    box-sizing: border-box;
}

/* Tooltip adaptado a fondo oscuro */
.tooltip {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

/* ===================================================== */
/*  COLORES DE NODOS POR TIPO – CAMBIAR AQUÍ LOS COLORES */
/* ===================================================== */

/* Autores (columna izquierda) */
.sankey-node.kind-author rect {
    /* COLOR AUTOR: cambia este valor si quieres otro tono */
    fill: rgba(129, 199, 245, 0.85);  /* azul suave */
}

/* --------------------------------------------- */
/*   COLORES POR LGAC (cambia aquí fácilmente)   */
/* --------------------------------------------- */

.sankey-node.lgac-espacio rect {
    fill: #4fa8b8 !important;      /* Azul petróleo suave */
}

.sankey-node.lgac-disenoarte rect {
    fill: #88c999 !important;      /* Verde menta suave */
}

.sankey-node.lgac-tecno rect {
    fill: #eab875 !important;      /* Naranja suave */
}

/* Resto de nodos */
.sankey-node.kind-author rect {
    fill: rgba(129,199,245,0.85);
}

.sankey-node.kind-role rect {
    fill: rgba(255,213,153,0.9);
}

.sankey-node.kind-tipo rect {
    fill: rgba(186,147,216,0.9);
}


/* Roles MIDAA / DIDAA (columna intermedia) */
.sankey-node.kind-role rect {
    /* COLOR ROL: modifica este valor si quieres diferenciar más MIDAA/DIDAA */
    fill: rgba(255, 213, 153, 0.9);   /* naranja/miel */
}

/* Tipos de publicación (Artículo, Capítulo, Libro)
   >>> AQUÍ cambias el color para TIPOS de producto <<< */
.sankey-node.kind-tipo rect {
    /* COLOR TIPOS: modifica este valor */
    fill: rgba(206, 147, 216, 0.95);  /* violeta suave */
}

/* Asegurar que no haya bordes no deseados */
.sankey-node rect {
    stroke: none;
}

/* Colores de la leyenda, para que coincidan visualmente con los nodos */
.legend-author {
    background: rgba(129, 199, 245, 0.85);
}
.legend-lgac {
    background: rgba(165, 214, 167, 0.9);
}
.legend-role {
    background: rgba(255, 213, 153, 0.9);
}
.legend-tipo {
    background: rgba(206, 147, 216, 0.95);
}
