/* MAPA COGNITIVO - SISTEMA DE VISUALIZACIÓN DE DATOS */

/* Variables específicas del mapa */
:root {
    --map-bg: rgba(10, 10, 15, 0.95);
    --node-color: var(--accent-color);
    --node-glow: var(--accent-glow);
    --connection-color: rgba(201, 169, 110, 0.3);
    --tension-line: rgba(255, 68, 68, 0.6);
    --node-recent: #4a90e2;
    --node-popular: #e24a4a;
    --node-debate: #9b4ae2;
    --node-size-min: 30px;
    --node-size-max: 80px;
    --connection-width: 1px;
    --tension-width: 2px;
}

/* Modo Entropía */
.entropia {
    --connection-color: rgba(255, 51, 102, 0.2);
    --tension-line: rgba(255, 102, 153, 0.8);
    --node-glow: rgba(255, 51, 102, 0.4);
}

/* Contenedor principal del mapa - CORREGIDO */
.cognitive-map-main {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--map-bg);
}

/* Contenedor del canvas - CORREGIDO: Eliminada propiedad duplicada */
.cognitive-map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Controles del mapa - CORREGIDO */
.map-controls {
    position: absolute;
    top: 20px;
    left: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(15, 15, 20, 0.8);
    backdrop-filter: blur(20px);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Canvas del mapa */
#cognitiveMapCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Tooltip de nodos */
.node-tooltip {
    position: absolute;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2rem;
    max-width: 300px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.node-tooltip h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.node-tooltip .category {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--accent-glow);
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--accent-color);
    margin-bottom: 0.8rem;
}

.node-tooltip .excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.8rem;
}

.node-tooltip .date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Panel de detalles del nodo - CORREGIDO */
.node-details-panel {
    position: absolute;
    right: 2rem;
    top: 20px;
    width: 400px;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    display: block;
}

.node-details-panel.active {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
}

.close-panel {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-panel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.panel-content {
    padding: 1.5rem;
}

.node-preview {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.node-connections h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.connection-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.connection-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-color);
}

.connection-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--accent-color);
}

.connection-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.connection-strength {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Líneas de tensión */
#tensionLines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

.tension-line {
    position: absolute;
    pointer-events: none;
    z-index: 500;
    height: var(--tension-width);
    background: var(--tension-line);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--tension-line);
    animation: tensionPulse 2s ease-in-out infinite;
}

@keyframes tensionPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Animaciones para nodos */
@keyframes nodeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes nodeGlow {
    0%, 100% { box-shadow: 0 0 20px var(--node-glow); }
    50% { box-shadow: 0 0 40px var(--node-glow); }
}

@keyframes entropyVibration {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(2px) rotate(0.5deg); }
    50% { transform: translateX(0) rotate(0deg); }
    75% { transform: translateX(-2px) rotate(-0.5deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

.entropia .node-tooltip {
    border-color: rgba(255, 51, 102, 0.3);
    background: rgba(10, 10, 15, 0.98);
    animation: entropyVibration 0.3s infinite;
}

/* Responsive - CORREGIDO */
@media (max-width: 1200px) {
    .node-details-panel {
        width: 350px;
    }
    
    .luxury-clock-container {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        margin: 2rem auto;
        display: flex;
        justify-content: center;
    }
}

@media (max-width: 992px) {
    .cognitive-map-main {
        height: calc(100vh - 80px);
    }
    
    .map-controls {
        top: 10px;
        left: 1rem;
        padding: 0.8rem;
    }
    
    .node-details-panel {
        width: 320px;
        top: 10px;
    }
}

@media (max-width: 768px) {
    .cognitive-map-main {
        height: calc(100vh - 60px);
    }
    
    .node-details-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        width: 100%;
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
    }
    
    .map-controls {
        flex-direction: row;
        flex-wrap: wrap;
        width: calc(100% - 2rem);
        left: 1rem;
        top: 10px;
    }
    
    .luxury-clock-container {
        margin: 1rem auto;
    }
    
    .luxury-clock {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 480px) {
    .cognitive-map-main {
        height: calc(100vh - 50px);
    }
    
    .map-controls {
        top: 5px;
        left: 0.5rem;
        padding: 0.5rem;
    }
    
    .luxury-clock {
        width: 200px;
        height: 200px;
    }
    
    .node-details-panel {
        max-height: 60vh;
    }
}